Skip to content

πŸ“Š Module 03: Algorithms

Estimated Time: 15-20 hours
Prerequisites: Modules 01 (Foundations), 02 (Data Structures)
Level: ⭐⭐⭐ Intermediate


🎯 What You'll Learn

Algorithms are step-by-step procedures for solving problems. In this module, you'll master:

  • Searching β€” Finding elements efficiently
  • Sorting β€” Organizing data in order
  • Recursion β€” Solving problems by breaking them into smaller pieces
  • Dynamic Programming β€” Optimizing by storing subproblem solutions
  • Greedy Algorithms β€” Making locally optimal choices
  • Divide and Conquer β€” Breaking problems into independent subproblems
  • Graph Algorithms β€” Traversing and analyzing connected data

πŸ“š Topics

# Topic Description Key Concepts
01 Searching Finding elements in collections Linear search, binary search
02 Sorting Ordering elements Bubble, selection, insertion, merge, quick sort
03 Recursion Self-referential problem solving Base case, recursive case, call stack
04 Dynamic Programming Optimization through memoization Overlapping subproblems, optimal substructure
05 Greedy Algorithms Local optimization strategies Greedy choice property, activity selection
06 Divide and Conquer Breaking down problems Merge sort, quick sort, binary search
07 Graph Algorithms Traversing connected structures BFS, DFS, shortest paths

🧠 Why Algorithms Matter

"An algorithm must be seen to be believed." β€” Donald Knuth

Understanding algorithms helps you:

  1. Write efficient code β€” Choose the right approach for each problem
  2. Pass technical interviews β€” Algorithms are a core interview topic
  3. Think systematically β€” Break complex problems into manageable steps
  4. Optimize performance β€” Know when O(n) vs O(nΒ²) matters

πŸ“– How to Study This Module

Step 1: Understand the Concept

Read each topic's README to understand: - What problem the algorithm solves - How it works (step by step) - When to use it - Time and space complexity

Step 2: Study the Examples

Run and modify examples.py to see algorithms in action:

cd 03_algorithms/01_searching
python examples.py

Step 3: Practice

Complete the exercises in exercises.py: - Start with the easier problems - Write code before looking at hints - Test with different inputs

Step 4: Test Your Knowledge

Take the quiz in quiz.md to verify understanding.


πŸ”‘ Key Complexity Classes

Understanding Big-O notation is crucial for this module:

Notation Name Example
O(1) Constant Array access by index
O(log n) Logarithmic Binary search
O(n) Linear Linear search
O(n log n) Linearithmic Merge sort
O(nΒ²) Quadratic Bubble sort
O(2ⁿ) Exponential Naive recursive fibonacci

πŸ—ΊοΈ Learning Path

01_searching ──────┐
                   β”œβ”€β”€β–Ί 03_recursion ──► 04_dynamic_programming
02_sorting ─────────                          β”‚
                   β”‚                          β–Ό
                   └──► 06_divide_and_conquer

02_sorting ──────────► 07_graph_algorithms (uses DFS/BFS)

Recommended order: 1. Start with Searching β€” simplest algorithms 2. Move to Sorting β€” builds on comparisons 3. Learn Recursion β€” fundamental technique 4. Study Divide and Conquer β€” applies recursion 5. Tackle Dynamic Programming β€” optimizes recursion 6. Explore Greedy Algorithms β€” alternative approach 7. Finish with Graph Algorithms β€” combines everything


πŸ’‘ Tips for Success

  1. Trace through by hand β€” Draw arrays and step through algorithms on paper
  2. Visualize β€” Use sites like visualgo.net to see algorithms animate
  3. Implement from scratch β€” Don't just read, write the code yourself
  4. Analyze complexity β€” Always think about time and space
  5. Practice variations β€” Same algorithm, different problems

πŸ“‚ Module Structure

03_algorithms/
β”œβ”€β”€ README.md (this file)
β”œβ”€β”€ 01_searching/
β”‚   β”œβ”€β”€ README.md
β”‚   β”œβ”€β”€ examples.py
β”‚   β”œβ”€β”€ exercises.py
β”‚   └── quiz.md
β”œβ”€β”€ 02_sorting/
β”‚   β”œβ”€β”€ README.md
β”‚   β”œβ”€β”€ examples.py
β”‚   β”œβ”€β”€ exercises.py
β”‚   └── quiz.md
β”œβ”€β”€ 03_recursion/
β”‚   β”œβ”€β”€ README.md
β”‚   β”œβ”€β”€ examples.py
β”‚   β”œβ”€β”€ exercises.py
β”‚   └── quiz.md
β”œβ”€β”€ 04_dynamic_programming/
β”‚   β”œβ”€β”€ README.md
β”‚   β”œβ”€β”€ examples.py
β”‚   β”œβ”€β”€ exercises.py
β”‚   └── quiz.md
β”œβ”€β”€ 05_greedy_algorithms/
β”‚   β”œβ”€β”€ README.md
β”‚   β”œβ”€β”€ examples.py
β”‚   β”œβ”€β”€ exercises.py
β”‚   └── quiz.md
β”œβ”€β”€ 06_divide_and_conquer/
β”‚   β”œβ”€β”€ README.md
β”‚   β”œβ”€β”€ examples.py
β”‚   β”œβ”€β”€ exercises.py
β”‚   └── quiz.md
└── 07_graph_algorithms/
    β”œβ”€β”€ README.md
    β”œβ”€β”€ examples.py
    β”œβ”€β”€ exercises.py
    └── quiz.md

βœ… Completion Checklist

  • Complete all 7 topic READMEs
  • Run and understand all examples
  • Solve at least 3 exercises per topic
  • Pass all quizzes with 80%+ score
  • Implement one algorithm from memory

Ready to start? Begin with 01_searching!