Please fill out this quiz, and press the "Submit" button at the end. Don't collaborate with anyone on quiz exercise solutions.
Please answer all questions.
SID: [No spaces and no dashes.]
Login ID :
1. Is n2 = O(n3)? Yes or no.
(If you cannot read the superscripts, this is asking: "Is n^2 = O(n^3)?".)
Algorithm Partition(A[0..n-1], midpoint): 1. Set i := 0. 2. For j := 0,1,..,n-1: 3. /* Invariant: ??? */ 4. If A[j] <= midpoint: 5. swap(A[i], A[j]). 6. Set i := i+1.
Let's prove that the Partition algorithm shown above is correct. State an invariant (at line 3) which is sufficient for this purpose.