CST 370: Week 6
This week we learned about two more trees: AVL and 2-3, as well as about heaps and hashing. AVL trees are balanced binary search trees that have a difference between the left and right subtrees of -1, 0, or 1. This difference is referred to as the balance factor (or balancing factor) and is specifically defined by the height of the left subtree minus the height of the right subtree. 2-3 trees on the other hand have subtrees with the same height and each node can have one or two values, where most other trees we've worked with have only one value per node. Heaps are complete binary trees, which consist of every level but the last needing to be completely filled and the last level orienting the existing nodes as far to the left as possible. Heaps are also defined by how the parent nodes relate to the child nodes, where each node in max heaps are greater than or equal to the numbers of its children and each node in min heaps are less than or equal to the numbers of its children. We learned to apply a couple of operations to max heaps and how to use arrays to store the values of a heap and how to use the HeapBottomUp algorithm to construct them. Lastly. we learned about hashing, which consists of creating functions that map variables of a larger set of numbers to a smaller fixed set of values. We also learned how to handle collisions, which consists of two variables with the same fixed hash value, by applying linear probing or separate chaining and how to decide or adjust the hash function by determining the load factor.
Comments
Post a Comment