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

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

View Full Document Right Arrow Icon
CSCI-255 Advanced Data Structures Lecture 21
Background image of page 1

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

View Full DocumentRight Arrow Icon
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
Background image of page 2
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
Background image of page 3

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

View Full DocumentRight Arrow Icon
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 )
Background image of page 4
Balancing a BST
Background image of page 5

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

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

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 Right Arrow Icon
Ask a homework question - tutors are online