Things get more complicated from this week. We learned the formal definitions of O(n²), Ω(n²) and θ(n²). The prof made an analogy of which compared O(n²) with the growing size of chicken and turkeys. This time, I get a better understanding of '700n^2 is no larger than 0.5n^2'. However, the challenging part is to calculate the steps that the maximum slice function takes in the worst case. There are so many while loops that I can hardly figure out the steps for each loop. And the proving part is easier after finding out the solutions to the problems.
Another great challenge is the penny pile problem. After reading through the instruction, I can easily reach the number 48. However, the follow up question was much more difficult to solve. The number of possible ways to transfer the pennies are huge, and a tree diagram might be a good choice to visualize the problem.
No comments:
Post a Comment