find a solution for the cost of the Max Array problem - Explains context and setting of problem, and why you would want to look at the recursive solution. Shows O(nlogn) cost of sorting to find solution and O(n-1) cost to do pairwise comparison - Gives Illustrative example to explain strategy or gives psuedocode ( do not write in Python) - Cost is O(n) and correctly evaluated - Assumes size of data is 2^k for math simplicity - Shows how there is 1 piece of size 2^k at top level, 2 pieces of size 2^(k-1), 4 pieces of size 2^(k-2), ..., 2^i pieces of size 2^(k-i), 2^k pieces of size 2^(k-k) OR n pieces of size 1 - Sum from 0 to k-1 of 2^i = (2^k -1)/(2-1) = 2^k - 1 (uses A.5 from Cormen) - Since n=2^k so 2^k - 1 is n-1 ==> Theta(n) or O(n)
find a solution for the cost of the Max Array problem
- Explains context and setting of problem, and why you would want to look at the recursive solution. Shows O(nlogn) cost of sorting to find solution and O(n-1) cost to do pairwise comparison
- Gives Illustrative example to explain strategy or gives psuedocode ( do not write in Python)
- Cost is O(n) and correctly evaluated
- Assumes size of data is 2^k for math simplicity
- Shows how there is 1 piece of size 2^k at top level, 2 pieces of size 2^(k-1), 4 pieces of size 2^(k-2), ..., 2^i pieces of size 2^(k-i), 2^k pieces of size 2^(k-k) OR n pieces of size 1
- Sum from 0 to k-1 of 2^i = (2^k -1)/(2-1) = 2^k - 1 (uses A.5 from Cormen)
- Since n=2^k so 2^k - 1 is n-1 ==> Theta(n) or O(n)


Trending now
This is a popular solution!
Step by step
Solved in 7 steps with 3 images









