On week 7, I wrote a slog about binary tree and recursion. Now I revisit it and I still agree my thinking at that time. It is true that binary tree gives us a relatively simple way to search a particular element compared to other trees. Maybe I should change "simple" to "efficient" because we learned about efficiency on last week and I think "efficient" is the better word to describe its attribute. Although searching time still depends on the number of elements or nodes(n) a binary tree has, it literally halves the n every time after it finished a comparison. We use lg(n+1) to represent the maximum times to search n nodes. lg(n+1) is same as log2(n+1). It becomes much smaller than n when n is getting larger. I've learned this in calculus.
Now let's talk about recursion. I feel more comfortable about recursion. I practiced a lot before the second term test. It was not difficult after several times of memorizing. Time I spend practicing is proportional to how fast and how well I write recursive program.
No comments:
Post a Comment