CIT 594 Final Exam Full Set With 100% Verified
Solutions Newest
What is a race condition in regards to Threads? - ANSWER 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)
Tree Set - ANS A set interface that uses a tree for storage
What does the factory method do? - ANSWER For the factory method pattern, we need
to define an abstract class that subclasses can use to return subclasses of the
dependency
what is the time complexity of a single for loop? - ANS O(n)
What is the time complexity of linked list's get operation? - ANS O(n)
How is the bucket number calculated for a hash set? - ANS hashcode %
number_of_buckets
AVL Tree - ANSWER a self-balancing sorted binary tree, in which the heights of subtrees
differ by at most 1.
Max Heap - ANSWER 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)
What does UML stand for? - ANSWER Unified Modeling Language
, How does a stack operate? - ANSWER -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
How does a queue operate? - ANSWER -adds to the rear and removes from the front
-It is a linked list that is first in first out
True/False, BSTs have only unique elements and keep their elements in order? -
ANSWER TRUE
What in general, is the time complexity for searching a BST? - ANSWER -O(h) where h is
the height, but O(n) in the worst case!
-For balanced trees, h=O(logn)
What is an AVL tree and why is it named AVL? - ANSWER -Its named AVL after its
inventors Adelson-Velsky and Landis
-It is a self balancing binary search tree
What is the time complexity for all self balancing BSTs? - ANSWER O(log₂n )
What are the four rules of a red black tree? - ANSWER 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
How much time do rotations take for self balancing BST's? - ANSWER O(1)
Solutions Newest
What is a race condition in regards to Threads? - ANSWER 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)
Tree Set - ANS A set interface that uses a tree for storage
What does the factory method do? - ANSWER For the factory method pattern, we need
to define an abstract class that subclasses can use to return subclasses of the
dependency
what is the time complexity of a single for loop? - ANS O(n)
What is the time complexity of linked list's get operation? - ANS O(n)
How is the bucket number calculated for a hash set? - ANS hashcode %
number_of_buckets
AVL Tree - ANSWER a self-balancing sorted binary tree, in which the heights of subtrees
differ by at most 1.
Max Heap - ANSWER 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)
What does UML stand for? - ANSWER Unified Modeling Language
, How does a stack operate? - ANSWER -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
How does a queue operate? - ANSWER -adds to the rear and removes from the front
-It is a linked list that is first in first out
True/False, BSTs have only unique elements and keep their elements in order? -
ANSWER TRUE
What in general, is the time complexity for searching a BST? - ANSWER -O(h) where h is
the height, but O(n) in the worst case!
-For balanced trees, h=O(logn)
What is an AVL tree and why is it named AVL? - ANSWER -Its named AVL after its
inventors Adelson-Velsky and Landis
-It is a self balancing binary search tree
What is the time complexity for all self balancing BSTs? - ANSWER O(log₂n )
What are the four rules of a red black tree? - ANSWER 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
How much time do rotations take for self balancing BST's? - ANSWER O(1)