Topics for Park's CMSC 341 Midterm 2:
- Review: Proof by Induction
- Review: Binary Search Tree (BST) vs. plain binary tree
- Traversal: inorder, preorder, postorder
- searching for specified value
- finding MinValue and MaxValue
- Amortized cost:
- You should be able to explain why growing a vector by doubling it
each time is amortized O(1) per insertion
(this was covered in class multiple times)
- AVL Trees
- Purpose of this struct
- AVL tree is a BST--allows fast search
- Balanced nature allows fast operations
- Structural properties of AVL tree
- Is a BST
- Balanced: heights of the children of node can differ by at most 1
- Overall height is O(log n)
- Insertion, deletion operations:
- Trinode retructuring:
- You should be able to sketch out effects of single and double
rotations
- Performance of AVL tree
- O(?) for: search, insertion, deletion
- Splay Trees
- Purpose of this struct
- Splay tree is a BST
- Minimizes average cost of operations
- However, does not guarantee specific performance of any single
operation
- Structural properties of splay tree
- Again, is a BST
- Not strictly balanced after any given operation, though
- Most-recently accessed value is at top
- Purpose of splaying
- Are splay trees balanced?
- Why do we do splaying?
- When are items splayed
- What item is splayed
- The zig, zig-zig, and zig-zag operations
- Performance properties of splay tree
- Cost of splaying: amortized cost
- Any single operation can be expensive (O(n))
- You only have to understand general concept of
"amortized cost" of splay trees, not details:
not responsible for proving anything
- Advantage of splay trees for frequently-accessed items
- Red-Black Trees
- Purpose of this struct
- R-B tree is a BST--allows fast search
- Balanced nature allows fast operations
- Structural properties of a R-B tree
- Know the 4 properties of R-B trees--IMPORTANT!
- Definition of "black depth"
- Bounds on true height of R-B tree O(log n)
- Balanced: black depth of all leaves is same
- Insertion operation:
- You should understand basic operation: search, followed by converting
dummy leaf to a new internal value node (what color?)
- Concept of "double red"
- Fixing double red: restructuring vs. recoloring
You should be able to sketch out basics of both
- Deletion operation:
- Need to be able to describe basic strategy
- What a "double black" is, how it arises
- You do NOT need to memorize the complex 3-case strategy for
resolving double black!
- Performance of R-B tree
- O(?) for: search, insertion, deletion
- Priority Queues, Heaps
- Operations and behavior of "priority queue" ADT
- Difference from regular queue ADT
- Various ways to implement a priority queue (list, sorted list,
tree, etc.)
- Purpose of the heap struct
- Structural properties of heap
- Conceptual model as a complete binary tree (but not a BST!)
- Implementation of a heap as an array
- Min heap vs max heap
- Insertion in a heap
- where to initially insert new element
- "Bubbling up"
- Deletion from a heap
- Where to find min (max) element in a min heap (max heap)
- How to delete
- "Bubbling down"
- Performance of heaps tree
- O(?) for: search, insertion, deletion
- True MinMax heap
- What it is--high level description
- How to find the min, max
- Do not need to know anything about implementation
- Hash Tables
- Purpose of this struct
- Structural properties of hash tables
- Bucket array
- Hash function
- Load factor
- Hash functions
- Difference between key and index
- Should be able to describe some simple hash functions
- Collisions
- What collisions are
- Chaining solution
- Open addressing (probing) solutions:
- Linear probing
- Quadratic probing
- Double hashing
- Probing and Clustering
- Probing and lazy deletion
- Performance of hash tables
- O(?) for: search, insertion, deletion of min (max)
Not all of these will be be specifically asked about on the exam,
but you are responsible for knowing it.