Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| courses:cs211:winter2018:journals:mccaffreyk:home:5 [2018/03/11 21:01] – mccaffreyk | courses:cs211:winter2018:journals:mccaffreyk:home:5 [2018/03/11 23:58] (current) – mccaffreyk | ||
|---|---|---|---|
| Line 8: | Line 8: | ||
| halt the recursion such as there only being 2 components left in each list. The recurrence relation of merge sort requires | halt the recursion such as there only being 2 components left in each list. The recurrence relation of merge sort requires | ||
| at its lowest level approximately n n/n processes. The maximum layers allowed is log(n). Thus, total running time is O(nlog(n)). Generally, we can solve recurrence relations either by unrolling them or guessing a solution and observing if it works or not. To unroll, we observe the layers and look for a pattern. Then, we sum over all layers. We may also use partial substitutions which is too mathematically dense for me to grasp. This section gets a 4/10 because I found it very confusing. I understand the basics but found it hard to achieve a thorough understanding. | at its lowest level approximately n n/n processes. The maximum layers allowed is log(n). Thus, total running time is O(nlog(n)). Generally, we can solve recurrence relations either by unrolling them or guessing a solution and observing if it works or not. To unroll, we observe the layers and look for a pattern. Then, we sum over all layers. We may also use partial substitutions which is too mathematically dense for me to grasp. This section gets a 4/10 because I found it very confusing. I understand the basics but found it hard to achieve a thorough understanding. | ||
| + | |||
| + | ==== Section 5.2: Further Recurrence Relations ==== | ||
| + | |||
| + | Now, we look at cases where the recursive tree is not binary. First, we assume that the size of the input is still /2 each time. However, now each parent node has 3 branches instead of 2. This will produce larger time increase as levels are added. Since 3>2, the efficiency in this situation is greater than linear time. However, it is still quadratic. Overall, this change is equivalent to O(n^log2(q)), | ||
| + | |||
| + | ==== Section 5.3: Counting Inversions ==== | ||
| + | |||
| + | Here, we apply the building blocks from other sections to solve several other recurrence related problems. For instance, we want a way to compute the number of inversions required to transform one into another with the same values but in a different order. Complete agreement between two sets means no inversions are required to make them match and complete disagreement means that the maximum number of inversions are needed(n/ | ||
| + | |||
