A Common-Sense Guide to Data Structures and Algorithms¶
Resources¶
Chapter Checklist¶
- 1. Why Data Structures Matter
- The Array: The Foundational Data Structure
- Reading
- Searching
- Insertion
- Deletion
- Sets: How a Single Rule Can Affect Efficiency
- Wrapping Up
- 2. Why Algorithms Matter
- Ordered Arrays
- Searching an Ordered Array
- Binary Search
- Binary Search vs. Linear Search
- Wrapping Up
- 3. Oh Yes! Big O Notation
- Big O: Count the Steps
- Constant Time vs. Linear Time
- Same Algorithm, Different Scenarios
- An Algorithm of the Third Kind
- Logarithms
- O(log N) Explained
- Practical Examples
- Wrapping Up
- 4. Speeding Up Your Code with Big O
- Bubble Sort
- Bubble Sort in Action
- Bubble Sort Implemented
- The Efficiency of Bubble Sort
- A Quadratic Problem
- A Linear Solution
- Wrapping Up
- 5. Optimizing Code with and Without Big O
- Selection Sort
- Selection Sort in Action
- Selection Sort Implemented
- The Efficiency of Selection Sort
- Ignoring Constants
- The Role of Big O
- A Practical Example
- Wrapping Up
- 6. Optimizing for Optimistic Scenarios
- Insertion Sort
- Insertion Sort in Action
- Insertion Sort Implemented
- The Efficiency of Insertion Sort
- The Average Case
- A Practical Example
- Wrapping Up
- 7. Blazing Fast Lookup with Hash Tables
- Enter the Hash Table
- Hashing with Hash Functions
- Building a Thesaurus for Fun and Profit, but Mainly Profit
- Dealing with Collisions
- The Great Balancing Act
- Practical Examples
- Wrapping Up
- 8. Crafting Elegant Code with Stacks and Queues
- Stacks
- Stacks in Action
- Queues
- Queues in Action
- Wrapping Up
- 9. Recursively Recurse with Recursion
- Recurse Instead of Loop
- The Base Case
- Reading Recursive Code
- Recursion in the Eyes of the Computer
- Recursion in Action
- Wrapping Up
- 10. Recursive Algorithms for Speed
- Partitioning
- Quicksort
- The Efficiency of Quicksort
- Worst-Case Scenario
- Quickselect
- Wrapping Up
- 11. Node-Based Data Structures
- Linked Lists
- Implementing a Linked List
- Reading
- Searching
- Insertion
- Deletion
- Linked Lists in Action
- Doubly Linked Lists
- Wrapping Up
- 12. Speeding Up All the Things with Binary Trees
- Binary Trees
- Searching
- Insertion
- Deletion
- Binary Trees in Action
- Wrapping Up
- 13. Connecting Everything with Graphs
- Graphs
- Breadth-First Search
- Graph Databases
- Weighted Graphs
- Dijkstra’s Algorithm
- Wrapping Up
- 14. Dealing with Space Constraints
- Big O Notation as Applied to Space Complexity
- Trade-Offs Between Time and Space
- Parting Thoughts