 # CS2420: Lecture 19 Vladimir Kulyukin Computer Science Department Utah State University.

## Presentation on theme: "CS2420: Lecture 19 Vladimir Kulyukin Computer Science Department Utah State University."— Presentation transcript:

CS2420: Lecture 19 Vladimir Kulyukin Computer Science Department Utah State University

Outline Binary Search Trees (Chapter 4) HeapSort (Chapter 7)

Binary Search Tree: Average Case Analysis Recall that the depth of the node is the length of the unique path from the root to that node. The sum of the depths of all nodes in the tree is the internal path length. The average case makes the assumption that all possible insertion/deletion sequences are equally likely.

Binary Search Tree: Average Case Analysis

The Heap-Order Property A Heap is a Complete Binary Tree. The Heap-Order Property: –In a heap, for every node X with parent P, the key in P is smaller than or equal to the key in X (minimal heap). –In a heap, for every node X with parent P, the key in P is greater than or equal to the key in X (maximum heap).

The Heap-Order Property P X P X The minimum heap-order property The maximum heap-order property