Ch 2 · Arrays & Lists — The Workhorse · Data Structures & Algorithms

Topic 2 of 10 in Data Structures & Algorithms — Foundations — 3 lessons.

What Is a List, Really?

A Python list is an array: a row of numbered boxes sitting next to each other in memory. Because they are numbered (starting at 0), the computer can jump straight to any box by its index — no searching required.

The Cost of List Operations

Not every list operation costs the same. Adding to the end is cheap. Inserting at the front is expensive, because every other item has to shuffle down one box to make room.

Two-Pointer Technique

Many array problems become O(n) instead of O(n²) with two pointers — one starting at the left, one at the right, walking toward each other. Here we check if a word is a palindrome without building anything new.

All topics in Data Structures & Algorithms Beginner

  1. Thinking Like a Computer Scientist
  2. Arrays & Lists — The Workhorse
  3. Stacks — Last In, First Out
  4. Queues — First In, First Out
  5. Linked Lists — Nodes on a Chain
  6. Searching — Finding the Needle
  7. Sorting — Putting Things in Order
  8. Recursion — Functions That Call Themselves
  9. Hash Tables — Instant Lookups
  10. Mini-Projects & Practice