less than 5 hours
I call them naps~~~
271 review notes:
*insertion sort O(n^2) fast when data size small
*MCS problems
i, brute-force -- for each pair of V(i,j) (i<=j) return max val O(n^3)
ii, reuse data -- V(i,j) = V(i, j-1)+A[j] O(n^2)
iii, divide and conquer -- MCS(A, i, floor((i+j)/2)), MCS(A, floor((i+j)/2)+1,j), find MCS contains both A[floor(i+j)/2)], A[floor(i+j)/2+1] return the max of the three O(nlogn)
*Polynomial Multiplication problem
i, brute force A(x)B(x) O(n^2)
ii, D&C (1) A0B0 A0B1 A1B0 A1B1 sum
D&C (2) (A0+A1)(B0+B1)(1) A0B0(2) A1B1(3) (2)+[(1)-(2)+(3)]^floor(n/2)+(3)^2floor(n/2)
*Partition(A, p, r) A[r] pivot, A[p..r] into 2 subarrays O(r-p)
*Randomized-partition
Randomized-quicksort
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment