CIT 594 Final Exam
What is an AVL tree and why is it named AVL?
-Its named AVL after its inventors Adelson-Velsky and Landis -It is a self balancing binary search tree
What in general, is the time complexity for searching a BST?
-O(h) where h is the height, but O(n) in the worst case ! -For balanced trees, h=O(logn)
How does a queue operate?
-adds to the rear and removes from the front -It is a linked list that is first in first out
How does a stack operate?
-think of a stack as literally a stack of bricks but each element contains data -It is a linked list that is last in first out
What are the four rules of a red black tree?
1) Each node is colored red or black 2) all null nodes are colored black 3) every red node has two black child nodes 4) Every path from any node to any null node must have the same number of black nodes. This is known as the "black-height" of the tree
Tree Set
A set interface that uses a tree for storage
What does the factory method do?
For the factory method pattern, we need to define an abstract class that subclasses can use to return subclasses of the dependency
How much time do rotations take for self balancing BST's?
O(1)
What is the time complexity for all self balancing BSTs?
O(log₂n )
What is the time complexity of linked list's get operation?
O(n)
what is the time complexity of a single for loop?
O(n)
True/False, BSTs have only unique elements and keep their elements in order?
TRUE
What does UML stand for?
Unified Modeling Language
What is a race condition in regards to Threads?
When you dont know what thread will finish first, so therefore the threads are "racing" against each other and you have thread non determinism... (not good)
Max Heap
a complete binary tree in which the value in each internal node is greater than or equal to the values of the children in those nodes(Note* NOT the SUM, just each individual value)
AVL Tree
a self-balancing sorted binary tree, in which the heights of subtrees differ by at most 1.
How is the bucket number calculated for a hash set ?
hashcode % number_of_buckets