225_16_binary_tree

# 225_16_binary_tree -...

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

If you have a max-heap where the values in the heap are distinct,  and you want to find the smallest value in the heap: 1. Where can it be in the heap? 2. How much time does it take to find it? 3. What would you do if you wanted to delete it?

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

View Full Document
Where could you put values 1-8?
3 Array positions of heap elements:

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

View Full Document
4 Assignment 2: Part A due Wed. Oct. 12. Part B due Fri. Oct. 14. Midterm: Tues. Oct. 18, in class. Midterm tutorial:  Sunday Oct. 16, 1pm in ECS 116. Bring any questions you have about old midterm exams. No office hours Oct. 19-21 (at conference)
5 http://www.nevron.com/Gallery.DiagramFor.NET.Symmetrical.aspx Lecture 11: Best Case  Binary Tree Sort

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

View Full Document
6 Binary search tree:  If a node has key value x then -all keys in the left subtree have a data value which is less  than or equal to x, and - all keys in the right subtree have a data value which is  greater than  x.
7 If items are inserted one by one, the resulting tree can have  arbitrary shape:

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

View Full Document
9 http://www.brpreiss.com/books/opus5/html/page304.html Worst Case  Shape Best Case  Shape

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

View Full Document
10 Inductive Definition of a Binary Search tree : A b ina ry s e a rc h tre e  is  b uilt up o f no de s  e a c h o f whic h ha s   a  ke y va lue , a  le ft c hild a nd a  rig ht c hild (whe re  the  c hildre n  a re  po inte rs  to  o the r no de s ).  [Basis] A tre e  with 0 no de s  is  a  b ina ry s e a rc h tre e  with ro o t
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 01/15/2012 for the course CSC 225 taught by Professor Valerieking during the Spring '10 term at University of Victoria.

### Page1 / 22

225_16_binary_tree -...

This preview shows document pages 1 - 11. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online