Monday, 4 November 2013

Week 7

This week my mine was blown when Danny implemented quicksort in 1 line because I expected it to take longer in order to implement it. An interesting point of binary search on trees is if I am only looking for one particular item only once then it makes more sense to leave the tree unsorted as it cost more resource to sort and balance the tree than to just traverse the tree. But it also important to note once you have balanced the tree, you can search the tree of a very low cost of log n. The question being is when to sort the tree to save time in the long run or to save time now instead of sorting and just find it. And to sort these structures it shows it is important to use a efficient algorithm to sort otherwise more resources are used unnecessary in order to find an item

1 comment:

  1. In order to search the tree in the low cost of log(n) as you mentioned, the tree doesn't have to be balanced, it simply has to be a binary search tree.

    ReplyDelete