Part VI: Algorithms and Data Structures

This is the heart of computer science.

Not Python. Not VS Code. Not even programming, exactly. The study of algorithms and data structures is the study of how to solve problems efficiently --- and that question predates computers by centuries. When you learn to analyze whether your approach scales to a million records or collapses under its own weight, you are engaging with the deepest ideas the discipline has to offer.

What This Part Covers

Chapter 17: Algorithms and Problem-Solving Strategies introduces the tools for reasoning about efficiency. You will learn Big-O notation --- not as a formal mathematical proof, but as an intuitive framework for asking "what happens when the input gets ten times bigger?" You will compare brute force, greedy, and divide-and-conquer strategies, and you will learn to trace through algorithms by hand before writing a single line of code. This chapter changes how you evaluate your own solutions.

Chapter 18: Recursion introduces functions that call themselves --- an idea that is initially bewildering and eventually beautiful. You will learn to identify base cases and recursive cases, trace recursive calls through the call stack, and build solutions to problems that are naturally recursive: tree traversal, fractal generation, directory walking. You will also learn when recursion is elegant and when it is a trap.

Chapter 19: Searching and Sorting applies your algorithmic thinking to the two most fundamental operations in computing. You will implement linear search, binary search, selection sort, insertion sort, and merge sort from scratch, compare their performance empirically and theoretically, and understand why Python's built-in sorted() uses Timsort. More importantly, you will learn to choose the right tool for the situation.

Chapter 20: Stacks, Queues, and Beyond introduces abstract data types --- structures defined by what they do, not how they are implemented. You will build stacks (last in, first out) and queues (first in, first out), use them for undo systems, expression evaluation, and breadth-first traversal, and get a preview of linked lists, trees, graphs, and hash tables that will motivate your next computer science course.

Why This Matters

Algorithms and data structures are what interviewers ask about, what performance reviews measure, and what separates a developer who can build a prototype from one who can build a system that serves millions. When your database query takes thirty seconds instead of thirty milliseconds, the problem is almost never the language or the hardware. It is the algorithm. The thinking skills you develop in Part VI will remain valuable long after any specific language or framework has been replaced.

What You Will Be Able to Do

By the end of Part VI, you will be able to:

  • Analyze algorithm efficiency using Big-O notation
  • Apply problem-solving strategies: brute force, greedy, divide and conquer
  • Write and trace recursive functions with confidence
  • Implement and compare classic searching and sorting algorithms
  • Build stacks and queues and apply them to real problems
  • Choose appropriate data structures based on performance requirements
  • Explain why algorithmic thinking matters beyond any single programming language

How the Chapters Connect

Chapter 17 gives you the analytical framework: Big-O, strategies, tracing. Chapter 18 adds recursion as a powerful problem-solving technique. Chapter 19 applies both to the concrete domain of searching and sorting, where you can measure and compare. Chapter 20 broadens the landscape, introducing the abstract data types that form the foundation of CS2 and beyond. Each chapter builds on the analytical habits established in the one before.

Your Progressive Project: TaskFlow

TaskFlow becomes a laboratory for algorithmic thinking. In Chapter 17, you will analyze and optimize TaskFlow's search and sort operations and add benchmarking to measure the difference (v1.6). In Chapter 18, you will implement recursive search through nested categories and subcategories (v1.7). In Chapter 19, you will add custom sorting --- by priority, due date, creation date, and alphabetically --- and implement binary search on sorted task lists (v1.8). In Chapter 20, you will build an undo/redo system using a stack and a task queue for scheduled execution (v1.9).

These are not toy exercises. Undo systems, priority queues, and efficient search are features users expect in real applications. You are building them from first principles.

Chapters in This Part