Student: Prexit Joshi (233118) | CSE 4th Sem, Section 2
-
Start with Basics :
- searching/README.md - Binary Search, Peak Finding
- divide-conquer/README.md - Max-Min
- sorting/README.md - All sorting algorithms
-
Build Foundation :
- greedy/README.md - Knapsack, Activity Selection
- graph/README.md - Dijkstra, MST algorithms
-
Master Complex Topics :
- dynamic-programming/README.md - DP problems
- backtracking/README.md - N-Queens
-
Specialized Algorithms :
- advanced/README.md - Strassen, Magic Square
- similarity/README.md - Jaccard, Cosine
Each category folder has a detailed README.md with:
- Clear explanations of how algorithms work
- When to use which algorithm
- Design patterns and paradigms
- Time complexity with derivations
- Space complexity
- Best/Average/Worst case scenarios
- Recurrence relations and Master Theorem
- Step-by-step dry runs
- Visual representations (ASCII art)
- Multiple examples for clarity
- Key points to remember
- Common mistakes to avoid
- Interview questions with answers
- Comparison tables
- Modern C++17 code
- Well-commented
- Ready to compile and run
File: sorting/README.md
Covers:
- Bubble Sort - O with optimization
- Selection Sort - Minimum swaps
- Insertion Sort - Best for nearly sorted
- Merge Sort - Guaranteed O(n log n)
- Quick Sort - Fastest in practice
- Comparison table & decision guide
Study Time: 2-3 hours
File: searching/README.md
Covers:
- Binary Search - O(log n) with overflow prevention
- Peak Finding 1D - Finding local maximum
- Peak Finding 2D - Matrix peak element
- Mathematical analysis of comparisons
Study Time: 1-2 hours
Exam Weight: (High)
File: divide-conquer/README.md
Covers:
- Max-Min Finding - 3n/2-2 comparisons
- D&C design pattern
- Master Theorem applications
- Comparison count analysis
Study Time: 1 hour
Exam Weight: (Medium)
File: graph/README.md
Covers:
- Dijkstra's Algorithm - Single-source shortest path
- Kruskal's Algorithm - MST with DSU
- Prim's Algorithm - MST vertex-centric
- Floyd-Warshall - All-pairs shortest path
- Graph representations
- When to use which algorithm
Study Time: 3-4 hours
Exam Weight: (Very High)
File: dynamic-programming/README.md
Covers:
- 0-1 Knapsack - Classic DP problem
- Matrix Chain Multiplication - Interval DP
- Multistage Graph - Graph DP
- DP fundamentals and patterns
- Memoization vs Tabulation
Study Time: 4-5 hours (Most Complex!)
Exam Weight: (Very High)
File: greedy/README.md
Covers:
- Fractional Knapsack - Sort by ratio
- Activity Selection - Sort by finish time
- Greedy vs DP comparison
- Proof of correctness
Study Time: 1-2 hours
Exam Weight: (High)
File: backtracking/README.md
Covers:
- N-Queens Problem - Classic backtracking
- Backtracking template
- Constraint satisfaction
- Pruning techniques
Study Time: 2 hours
Exam Weight: (High)
File: advanced/README.md
Covers:
- Strassen's Matrix Multiplication - O(n^2.807)
- Magic Square Generation - Siamese method
- Advanced D&C techniques
Study Time: 1-2 hours
Exam Weight: (Medium)
File: similarity/README.md
Covers:
- Jaccard Similarity - Set-based
- Cosine Similarity - Vector-based
- Real-world applications
- When to use which metric
Study Time: 1 hour
Exam Weight: (Low-Medium)
Day 1-2: Sorting + Searching (Foundation)
- Complete sorting/README.md
- Complete searching/README.md
- Practice dry runs on paper
Day 3-4: Graph Algorithms (Most Important!)
- Complete graph/README.md
- Memorize Dijkstra, Kruskal, Prim
- Practice drawing graphs
Day 5-6: Dynamic Programming (Hardest!)
- Complete dynamic-programming/README.md
- Focus on 0-1 Knapsack and MCM
- Draw DP tables
Day 7: Revision
- Greedy (greedy/README.md)
- Backtracking (backtracking/README.md)
- Quick review of all
- Quick revision of key algorithms (3 hours)
- Practice complexity analysis (1 hour)
- Memorize important formulas (1 hour)
- Sleep well!
- Binary Search - Most basic, must know perfectly
- Merge Sort - Complete working
- Quick Sort - Partition logic
- Dijkstra - Single-source shortest path
- Kruskal - MST with DSU
- 0-1 Knapsack - DP table filling
- MCM - Recurrence relation
- N-Queens - Backtracking pattern
- Master Theorem - All three cases
- Recurrence Relations - How to solve
- **Big-O - Definitions
- Best/Average/Worst - For each sorting algorithm
Prepare comparisons between:
- Bubble vs Insertion vs Selection
- Merge Sort vs Quick Sort
- Dijkstra vs Floyd-Warshall
- Kruskal vs Prim
- Greedy vs DP
- 0-1 vs Fractional Knapsack
- Backtracking vs Brute Force
g++ -std=c++17 -O2 -o output.exe folder/program.cpp
.\\output.exe# Sorting
g++ -std=c++17 -O2 -o quick.exe sorting/quicksort.cpp
.\\quick.exe
# Graph
g++ -std=c++17 -O2 -o dijkstra.exe graph/dijkstra.cpp
.\\dijkstra.exe
# DP
g++ -std=c++17 -O2 -o knapsack.exe dynamic-programming/0-1knapusingdptable.cpp
.\\knapsack.exe- Read question carefully - Note keywords (best case, worst case, etc.)
- State time complexity first - Shows you know the answer
- Draw diagrams - Visual representations earn marks
- Show all steps - Partial marks for method
- Write recurrence relation - For recursive algorithms
- Write algorithm in pseudocode first - Shows understanding
- Mention complexity - Time and space
- Handle edge cases - Empty array, single element
- Use proper variable names - Shows clarity
- Add comments - Explain key steps
- Make a table - Organized presentation
- Show each iteration - Step-by-step
- Circle/highlight changes - Visual clarity
- Count comparisons/swaps - If asked
- Verify final answer - Check correctness
- Forgetting base cases in recursion
- Integer overflow in mid calculation (use
low + (high-low)/2) - Mixing up Kruskal (edge-centric) and Prim (vertex-centric)
- Thinking greedy works for 0-1 Knapsack (it doesn't!)
- Forgetting to backtrack in N-Queens
- Wrong order in DP table filling
- Negative weights with Dijkstra (use Floyd-Warshall)
- CLRS (Cormen) - The bible of algorithms
- Sedgewick - Algorithms in C++
- GeeksforGeeks - Practice problems
- LeetCode - Interview preparation
- Complexity cheat sheets in each README
- Comparison tables in each README
- This study guide!
Before exam, can you:
- Explain why Quick Sort is O(n\u00b2) worst case
- Draw Merge Sort recursion tree
- Dry run Bubble Sort with optimization
- Compare all 6 sorting algorithms
- Write Binary Search without bugs
- Explain peak finding logic
- Calculate number of comparisons
- Trace Dijkstra's algorithm on paper
- Explain DSU in Kruskal
- When to use which algorithm
- Floyd-Warshall DP table filling
- Fill 0-1 Knapsack DP table
- Write MCM recurrence relation
- Backtrack to find items selected
- Explain optimal substructure
- Prove fractional knapsack greedy works
- Why sort by finish time in activity selection
- When does greedy fail
- Explain N-Queens safety check
- Write backtracking template
- Calculate time complexity
- Practice on paper - Exams are written, not coded
- Time management - Don't spend too long on one question
- Attempt all questions - Partial marks count
- Revise one day before - Don't learn new things last minute
- Stay calm - You've got this!
Stuck on a concept?
- Read the relevant README again
- Run the program and observe output
- Draw diagrams on paper
- Try explaining to someone else
**Good luck with your exam preparation! **
Remember: Consistent practice > Last-minute cramming
Study smart, not just hard!
Prexit Joshi (233118)