CST370 - Week 6
This was our sixth week in CST 370 - Design and Analysis of Algorithms. AVL Tree An AVL Tree is a balanced binary search tree where the difference in height between the left and right subtrees is either -1, 0, or 1. The difference between subtrees is called a balance factor or balancing factor. What do we do if a Binary Tree is unbalanced (not an AVL Tree)? We can perform a R, L, RL, or LR rotation to make it balanced. This AVL Tree Visualizer may be helpful. 2-3 Tree A 2-3 Tree is a type of search tree where each node can have one or two values. If a node has three values, we promote the middle value to the parent node (or make it the new root node). Visualizations: 2-3 Trees B-Trees Heaps A heap is a type of Complete Binary Tree. There are two types of heaps: a Max Heap and a Min Heap. Max Heap: The number of each node is greater than or equal to the numbers of its children. Min Heap: The number of each node is smaller than or...