Presentation is loading. Please wait.

Presentation is loading. Please wait.

Searching and BST Exercises

Similar presentations


Presentation on theme: "Searching and BST Exercises"— Presentation transcript:

1 Searching and BST Exercises
CSCI 3333 Data Structures Searching and BST Exercises by Dr. Bun Yue Professor of Computer Science

2 Binary Search Provide a recursive algorithm for binary search.

3 BST Insertion Show the BST after the insertion of the following records to an initially empty tree: 10, 4, 20, 22, 18, 35, 7, 9, 27, 60, 3, 44

4 BST Deletion Using the deletion algorithm in the slide, show the evolution of the BST [[3 4 [[] 7 9]] 10 [18 20 [[] 22 [27 35 [44 60 []]]]]] [[3 4 [[] 7 9]] 10 [18 20 [[] 22 [27 35 [44 60 []]]]]] after the records 10, 7, 22 and 20 are deleted in sequence.

5 BST Search Consider the BST [[3 4 [[] 7 9]] 10 [18 20 [[] 22 [27 35 [44 60 []]]]]]. What is the average number of key comparison for successful search?

6 BST Variation Suppose the BST ADT is modified so that key values are no longer unique (i.e. several records can have the same key values). Describe the implications to the ADT and the implementation.

7 Questions and Comments?


Download ppt "Searching and BST Exercises"

Similar presentations


Ads by Google