This week we have mainly talked about binary trees with balancing children with the left ones smaller than the root and the right ones bigger than the root. Thus, less conditions need to be considered before running recursion for deleting items.Similarly in search list, it is easier by applying the idea of recursion to find the number. However, the binary tree has to be balance in both sides, that is to say, has the same depth for both sides in order to cut in half repeatedly.
We also discussed the run time of different functions. Binary tree mainly use log2n which is almost the slowest in long term. The run time big-Oh is similar to what being taught in csc165. Glad to see how these two courses are finally related. It is interesting to calculate different run time functions and get an idea which one applies better in different conditions. All in all, binary search uses the least step to calculate.
This week's exercise and lab is pretty straight forward by applying recursion, but there are always a lot easier ways to do them and we can improve. A2 part will due in one week which struggle me a lot. Hope I can finish it before next week that I have 3 tests coming up.
No comments:
Post a Comment