This week I focused on understanding different data structures that improve search efficiency, including AVL trees, 2-3 trees, heaps, and hashing. I learned how AVL trees maintain balance using balance factors and rotations, and how to identify when rotations like left, right, or double rotations are needed after insertion. For 2-3 trees, I studied how nodes can store one or two keys and how promotions work to keep the tree balanced with all leaves at the same level.
I also learned about heaps and how they are implemented as complete binary trees. I practiced operations such as inserting elements, deleting the maximum, and building a heap using both top-down and bottom-up approaches. Understanding how heaps are represented using arrays helped me see how parent and child relationships are calculated using indices. I explored heap sort and how it repeatedly removes the maximum element to produce a sorted sequence with O(n log n) time complexity.
For hashing, I learned how hash functions map keys to table indices and how collisions occur when multiple keys map to the same location. I studied collision resolution methods such as separate chaining and linear probing, and I learned how load factor affects performance. I also learned why rehashing is needed when the table becomes too full and how resizing to a larger prime number helps reduce collisions.
Working on HW5 helped reinforce these concepts because I had to implement heap operations and a hash table with linear probing and rehashing. I spent time testing edge cases, debugging commands like tableSize, and verifying load factor calculations. I also practiced quiz questions to strengthen my understanding of how these data structures behave in different scenarios. Overall, this week helped me connect theory with practical implementation and improved my confidence in working with efficient data structures.
Comments
Post a Comment