# Notes 13 - Week 13 Binary Search Trees Some of the material...

This preview shows pages 1–2. Sign up to view the full content.

Week 13: Binary Search Trees Some of the material covered is contained in Chapter 25 (about bst) and the rest is in Chapter 27 about bst implementations. Definitions: A binary search tree is an ordered binary tree such that for every node all data is less on the left subtree all data is greater on the right subtree No duplicates allowed in some versions of BST’s. Task 1: Determine if the binary tree is a bst. 50 / \ 10 60 / \ / \ 5 40 30 70 Answer : No because 30 is a right child of 50. Now do #14 and 15 on page 660 and check your answers in the appendix. Note: The inorder traversal is an ascending sequence of the data! So another way to sort data would be to create a bst and then do the inorder traversal. Searching a bst is faster as there is no need to backtrack however the worst case has a big oh of n due to shape of the worst case is a linked list. But a complete bst has a worst case search of O(log n) Task 2: Read section 27.42 on page 726 and review figure 27-14 on page 727 then read 27.44 motivation of tree balancing which we cover after Heaps in a couple

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern