Test #2 Flashcards
Why do we want the initial data of a BST to come in randomly?
so the BST fills in instead of becoming a linked list
What is an AVL tree?
BST that remains balanced upon insertion or deletion
What does AVL stand for?
Adelson, Velskii, and Landis whom are the inventors
Why do we want to balance a tree?
peak efficiency: makes O(log n) instead of worst case being O(n)
What is a splay tree?
a BST that moves each node that is accessed into the root node
What does the word splay mean in general?
spead out or scatter
Why do we want to splay a tree?
because 90% of the accesses of a BT occur on only 10% of the data.
What is the 90/10 rule?
When 90% of the accesses of a BST occur on only 10% of the data
AVL tree vs splay tree uses
splay : fast lookup on recently used items
AVL : if lookup is a lot more common than insertion/deletion
Hashing definition
technique that maps a key to its corresponding hash value
When and why do we want to use hashing as compared to binary search trees?
Best and avg case of O(1)
What are some common applications that use hashing?
Password verification, part lookup
What constitutes a good hashing function?
Load Factor (% of slots in use) is kept under 50% to minimize collisions and to have more wiggle room. Once 50% is reached, double size of table and rehash.
What is a collision?
when two keys are hashed to the same location
What is a perfect hash function?
no collisions