×
It does not matter how slowly you go as long as you do not stop.

# Note for Data Structure and Algorithms - DSA by Kajal Sanklecha

• Data Structure and Algorithms - DSA
• Other
• 287 Views
Page-1

#### Note for Data Structure and Algorithms - DSA by Kajal Sanklecha / 89

0 User(s)

#### Text from page-1

Analysis of Algorithms CS 477/677 Heapsort Instructor: George Bebis (Chapter 6, Appendix B.5)

#### Text from page-2

Special Types of Trees • Def: Full binary tree = a binary tree in which each node is either a leaf or has degree exactly 2. • Def: Complete binary tree = a binary tree in which all leaves are on the same level and all internal nodes have degree 2. 4 1 3 2 14 16 9 8 10 7 12 Full binary tree 4 1 2 3 16 9 10 Complete binary tree 2

#### Text from page-3

Definitions • Height of a node = the number of edges on the longest simple path from the node down to a leaf • Level of a node = the length of a path from the root to the node • Height of tree = height of root node Height of root = 3 4 1 Height of (2)= 1 2 14 3 16 9 10 Level of (10)= 2 8 3

#### Text from page-4

Useful Properties height height (see Ex 6.1-2, page 129) d +1 2 −1 n   2l = = 2d +1 − 1 2 −1 l =0 d 1 Height of (2)= 1 2 14 Height of root = 3 4 3 16 9 10 Level of (10)= 2 8 4