# lecture21 - CSCI-255 Advanced Data Structures Lecture 21...

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

CSCI-255 Advanced Data Structures Lecture 21

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

View Full Document
Time Complexity of Basic BST Operations b Search, Insert, Delete s These operations visit the nodes along a root-to-leaf path (e.g., Search(15), Insert(19), Delete(21)) s The number of nodes encountered on unique path depends on the shape of the tree and the position of the node in the tree
Time Complexity of Basic BST Operations (cont’d) b Worst-case running time of each operation? s O( h ) where h is the height of the tree b The height depends on the shape of the tree. Let’s compute the average running time (i.e., for an “average node position”) of each operation for each of the following cases s A “worst-shape” BST (DONE IN CLASS) s A “best-shape” BST s An “average-shape” BST

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

View Full Document
Balancing a BST b BSTs are limited because of their bad worst-case performance O( n ). A BST with this worst-case structure is no more efficient than a regular linked list b Balanced search trees are trees whose heights in the worst case is O(lg n )
Balancing a BST

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.

## This note was uploaded on 11/26/2009 for the course MATH AND C CSCI255 taught by Professor Dr.ikergondraluja during the Spring '09 term at St. Francis Xavier, Antigonish.

### Page1 / 12

lecture21 - CSCI-255 Advanced Data Structures Lecture 21...

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

View Full Document
Ask a homework question - tutors are online