40 likes | 156 Views
In Week 9 of CS-2852, we explore key concepts in data structures, focusing on hash codes and AVL trees. Dr. Josiah Yoder highlights the importance of hash codes, emphasizing that the hash code of an object must remain constant unless the object itself changes. The principles of equality (if a.equals(b), then a.hashCode() == b.hashCode()) and how to efficiently manage data structures using AVL trees are discussed. Additional resources include links to detailed explanations of AVL and Red-Black trees, enhancing your understanding of these fundamental data structures.
E N D
CS-2852Data Structures • Week 9, Class 1 • Hash-code parting remarks • Rotations • AVL Trees CS-2852 Dr. Josiah Yoder Slide style: Dr. Hornick
General Contract for HashCode • Must not change if object doesn’t change • If a.equals(b), then a.hashCode() == b.hashCode() • If !a.equals(b), then perhaps a.hashCode() == b.hashCode() But it is better if a.hashCode() != b.hashCode() CS-2852 Dr. Josiah Yoder Slide style: Dr. Hornick
AVL Trees http://www.qmatica.com/DataStructures/Trees/AVL/AVLTree.html Red-black trees http://gauss.ececs.uc.edu/RedBlack/redblack.html (Third Google hit for “red black tree”) CS-2852 Dr. Josiah Yoder Slide style: Dr. Hornick
CS-2852 Dr. Josiah Yoder Slide style: Dr. Hornick