Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 12. Binary Trees > 12.10 EFFICIENCY OF BST SEARCH AND RETRIEVAL

12.10 EFFICIENCY OF BST SEARCH AND RETRIEVAL

The operations take place upon ordered data using a process similar to array binary search. Until the sought value is found, further comparisons will involve either its left-hand sub-tree or its right-hand sub-tree. If the tree is balanced, this amounts to dividing the tree in two at each comparison since there will be an equal number of items in each sub-tree (or nearly so). The best case efficiency for a balanced tree is then the same O(log2N) as for binary search. However, for a tree that is not balanced the efficiency will fall below this value as illustrated in Figure 12.30.

Figure 12.30. Retrieving a key value



  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial