CSC Algorithms & Data Structures: One-Day Study
Cheat Sheet
1. Core Concepts Summary
Topic
Core Idea
Time Complexity
Red-Black TreeBalanced BST with color rules ensuring O(log n) height
O(log n)
Example Use
Ordered map, self-balancing BST
Hashing
Maps keys → indices via hash function; resolve collisions by chaining/probing
O(1) avg, O(n) worst Dictionaries, symbol tables
Heap / Priority Queue
Binary tree in array form; parent < children (min-heap)
HeapSort
Build max-heap, repeatedly extract max to sort
O(log n)
Scheduling, Dijkstra’s algorithm
O(n log n)
In-place sorting
Divide & Conquer
Divide → Conquer → Combine; recursive subproblem solving
O(n log n) typical
MergeSort, Binary Search
Greedy AlgorithmLocally optimal → globally optimal (if problem allows)
Varies, often O(n logActivity
n)
Selection, Huffman Coding
2. One-Day Study Flow
Morning (0–3 hrs): Visual understanding & key rules — Red-Black Trees, Hashing, Heaps.
Midday (3–6 hrs): Algorithm focus — HeapSort, Divide & Conquer.
Evening (6–8 hrs): Greedy algorithms + review table + active recall.
Tip: Use VisuAlgo.net for animations, trace one example per topic by hand, and summarize each in
1–2 sentences.
3. Quick Recall Facts
- Red-Black Trees: No two reds adjacent; same black-height across paths.
- Hashing: Good hash minimizes collisions; load factor ≈ 0.75 ideal.
- Heap: Represented in array; children at indices 2i+1, 2i+2.
- HeapSort: Not stable; no extra memory.
- Divide & Conquer: Recurrence often solved by Master Theorem.
- Greedy: Works when greedy-choice + optimal substructure hold.
4. Practice Prompts (Do 1 per topic)
1. Red-Black Tree – Identify rotation and recoloring steps for insert(7).
2. Hashing – Compute hash positions and handle collisions for keys [12, 44, 13, 88, 23, 94, 11, 39].
3. Heap – Convert [5, 3, 8, 4, 1] into a min-heap by hand.
4. HeapSort – Sort [7, 2, 5, 1, 9] step-by-step using heap extraction.
5. Divide & Conquer – Apply Master Theorem to T(n) = 2T(n/2) + O(n).
6. Greedy – Choose max number of non-overlapping intervals from sample set.