Skip to content

Phase 1: Fundamentals

šŸŽÆ What You'll Learn

This phase teaches the foundation you need before learning any data structure or algorithm.

Core Topics

  • Big O Notation - How to measure efficiency
  • Time Complexity - How algorithms scale
  • Space Complexity - Memory usage analysis
  • Basic Concepts - What makes a good data structure

šŸ“– The Big Picture

Before diving into arrays, linked lists, trees, etc., you need to answer:

"Why do we care about different data structures?"

The answer: Different structures have different performance characteristics.

The Key Insight

Array: O(1) access, O(n) insertion Linked List: O(n) access, O(1) insertion Hash Table: O(1) access, O(1) insertion (usually)

You can't choose the "best" structure until you understand these trade-offs.


šŸŽ“ Topics in Phase 1

1. Data Structures Overview (01-datastruct.md)

  • Classification of data structures
  • Time complexity comparison table
  • When to use each structure
  • Memory considerations

Duration: 1-2 hours
Goal: Understand what options exist


šŸ’” Key Concepts You Must Grasp

1. Big O Notation

  • O(1) - Constant time
  • O(log n) - Logarithmic (very efficient)
  • O(n) - Linear
  • O(n log n) - Typical for sorting
  • O(n²) - Quadratic (less efficient)
  • O(2ⁿ) - Exponential (very inefficient)

2. Time vs Space Tradeoff

Many algorithms trade time for space: - Faster algorithms use more memory - Slower algorithms use less memory - Choose based on your constraints

3. Best, Average, Worst Cases

  • Best case: Optimal input scenario
  • Average case: Typical scenario (most important!)
  • Worst case: Pathological input

šŸš€ Your First Assignment

Understand This Table

Operation Array Linked List Hash Table
Access O(1) O(n) O(1) avg
Insert O(n) O(1) O(1) avg
Delete O(n) O(n) O(1) avg
Search O(n) O(n) O(1) avg

Question: Why is inserting O(1) in linked lists but O(n) in arrays?

Answer: Arrays must shift elements; linked lists just update pointers.


āœ… Phase 1 Mastery Checklist

After this phase, you should be able to:

  • [ ] Explain Big O notation to someone
  • [ ] Compare time complexity of different approaches
  • [ ] Recognize which data structure to use for a problem
  • [ ] Understand time vs space tradeoffs
  • [ ] Identify best/average/worst cases
  • [ ] Calculate complexity of a code snippet

šŸ“‹ Phase 1 Progress

  • [x] Fundamentals Overview
  • Big O notation
  • Time complexity analysis
  • Space complexity analysis
  • Data structure comparison

šŸŽÆ Ready to Move to Phase 2?

If you can answer these questions, you're ready:

  1. What's the difference between O(n) and O(n²)? (1 million vs 1 trillion operations)
  2. Why would you use a hash table instead of an array? (O(1) lookup vs O(n))
  3. What's the space-time tradeoff? (Trade memory for speed or vice versa)

šŸ“š Next: Phase 2 - Core Data Structures

Once you understand fundamentals, you'll learn:

  1. Arrays - The simplest structure
  2. Linked Lists - Dynamic allocation
  3. Stacks & Queues - Specialized access patterns
  4. Hash Tables - The fast lookup champion

Each builds on concepts from Phase 1.


Duration: ~1 week
Status: āœ… Complete
Next Phase: Phase 2 (2 weeks)