Test 2 Review
- Red black trees:
- Properties of Binary Search Trees
- Properties of Red black trees
- If black-height is b and the height of the tree is h,
then b<=h<=2b
- h = b when all the nodes in the tree are black
- h=2b when you have red and black nodes in alternating levels
- Sample Questions:
- Justify whether a given tree is a legal Red Black
Tree/Binary Tree/Balanced Search Tree
- Insertion (show rotations if needed)
- Maximum and minimum number of elements in a Red Black Tree with
black height b
- B-Trees:
- A B-tree with
minimum dregree k >= 2 has following properties
- Number of keys in root: 1<= #keys <= 2k-1
- Number of keys in other nodes:
k-1 <=
#keys <= 2k-1
- Each node will have exactly #keys stored in that node + 1
number of children
- All leaves will be in the same level
- only a root split can increase the height of a B-tree
- Sample Questions:
- For a given tree justify if it is a legal B-tree
- For a given set of numbers come up with all possible legal
B-trees
- Maximum and minimum number of keys possible to store in a B-tree
- Insertion in a B-tree (show node split if needed)
- Augmenting Data Structures:
- Methodology for augmenting data structures: Determine data structure, determine additional information to be stored, maintain new operations in operations that modify the data structure, develop new operations that use the additional information.
- Dynamic order statistics.
- Interval trees.
- Range Trees:
- New BST ordering with keys in the leaves.
- Definition of one-dimensional range tree, and range search algorithm (using canonical sets = subtrees in between search paths)
- Different range query types: Existence, counting, reporting.
- Higher-dimensional (nested) range trees
- (No fractional cascading)
- Dynamic Programming (DP):
- It is a problem solving technique (or algorithm design
technique) where
- each subproblem is solved only once and the solution
is stored in a Dynamic Programming Table (DP table)
- and this stored Value/Solution will be used later
whenever needed
- This approach can be used only if the problem has
the following two
properties:
- Overlapping Subproblems
- Optimal Substructure
- Sample Questions:
- Understand a given recursive solution, and
analyze the time and space needed for a
brute-force implementation of the recursion.
- Develop a recursive solution for a problem similar to problems covered in class or on the homework.
- Design a DP algorithm using a given recurrence and either
of the following approaches
- Bottom-up: this approach uses
a loop and fills the whole DP table bottom-up
- Memoization: this approach uses
recursion and fills only the cells of the DP table which are needed
- Analyze time and space of your DP algorithm
- Give an algorithm to fill the DP Table for a given recursive solution and compute the
solution from it
Greedy Algorithms
- Greedy Strategies:
- repeatedly identify the decision
to be made (recursion)
- make a locally optimal choice for each decision
- Greedy doesn't always work.
- Sample Questions:
- Short questions or true/false
about the concepts
- Come up with a greedy solution to a
problem or with a counter-example why a greedy solution
does not work.
Amortized Analysis:
- Aggregate analysis, accounting method
- (No potential method)
- Binary counter, dynamic tables
Union-Find:
- Union-find data structure definition (operations)
- List implementation, tree implemention
- Union by weight/rank, path compression
- Ackermann function, inverse Ackermann function