lecture8

# lecture8 - Hashes Red-Black Trees Hashes Red-Black Trees...

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

Hashes Red-Black Trees IE170: Algorithms in Systems Engineering: Lecture 8 Jeﬀ Linderoth Department of Industrial and Systems Engineering Lehigh University January 31, 2007 Jeﬀ Linderoth IE170:Lecture 8 Hashes Red-Black Trees Taking Stock Last Time Hashes (Intro to) Binary Search Trees More on Java Collections Interfaces lab == fun This Time Binary Search Trees Java Collections Interfaces: Maps Heaps and Heapsort Jeﬀ Linderoth IE170:Lecture 8 Hashes Red-Black Trees Java Collections Binary Search Tree A binary search tree is a data structrue that is conceptualized as a binary tree. (Have you read Appendix B-4 yet?) Each node in the tree contains: key k . (Or maybe (key, value): ( k, v ) ) left l : Points to the left child right r : Points to the right child parent p : Points to the parent Binary Search Tree Property If y is in the left subtree of x , then k ( y ) k ( x ) Jeﬀ Linderoth IE170:Lecture 8 Hashes Red-Black Trees Java Collections Binary Search Trees There are lots of binary trees that can satisfy this property. It is obvious that the number of binary tree on n nodes b n is b n = 1 n + 1 ± 2 n n ² b n = 4 n πn 3 / 2 (1 + O (1 /n )) And not all of these (exponentially many) are created equal. In fact, we would like to keep our binary search trees “short”, because most of the operations we would like to support are a function of the height h of the tree. Jeﬀ Linderoth IE170:Lecture 8

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

View Full Document
Hashes Red-Black Trees Java Collections Short Is Beautiful search() takes O ( h ) minimum() , maximum() also take O ( h ) Slightly less obvious is that insert() , delete() also take O ( h ) Thus we would like to keep out binary search trees “short” ( h is small).
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 5

lecture8 - Hashes Red-Black Trees Hashes Red-Black Trees...

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

View Full Document
Ask a homework question - tutors are online