Directions: Each of the first two questions is a statement that may be true or false. Please state whether it is true or false -- you will get five points for a correct boolean answer and there is no penalty for a wrong guess. Then justify your answer -- the remaining points will depend on the quality and validity of your justification.
BigInteger variables of length n requires time Ω(n2).
Permutation class from
Discussion 6. An object of this class stored a function from the set {1,...,n}
to itself. Assume we have a method public int apply(int x) that
returns the value of this function on input x. (The other implementation
details of Permutation should not be relevant here.) We want to
create a new method public boolean reachable (int x, int y) in
this class. This method should return true if there is an integer k ≥ 0 such
that applying the function k times takes the element x to the element y.
apply takes O(1) time. int values, all distinct. The middle-third problem is
to create an array B of length n/3 such that the values in B consist of the
elements in A of rank n/3+1, n/3+2,..., and 2n/3, in any order. (The element
of rank i is the one that is larger than exactly i-1 of the other elements.)
Last modified 10 November 2003