Practical Data Structures and Algorithms

Learn common data structures and algorithm patterns through selected LeetCode problems. Write Python solutions, trace their behavior, and check correctness and computational cost.

Introductory · no CS background required · 8 weeks

Questions and practice

How should we store and search records, process recent events, or follow dependencies? Solve a small problem first, then connect the pattern to tasks such as duplicate detection, event processing, and job ordering.

Solve LeetCode problems aligned with each week's concepts. State the input and output, write a solution, trace a small example, and test edge cases. Explain why the chosen structure fits the task.

Before you start

Basic Python variables, conditionals, loops, and functions. Review these before Week 1 if they are unfamiliar. Prior algorithms study and advanced mathematics are not required.

This course and Practical SQL for Data Analysis and Applications can be taken independently. Choose SQL first for table-based analysis, or algorithms first for Python data processing.

Eight-week plan

Weeks 1-8 include lecture pages, worked solutions, independent exercises, and runnable Python files. Use the Week 1 reference sheets and instructor guide alongside the exercises.

Week 2

Sliding windows and stacks

Longest Substring Without Repeating Characters; Minimum Size Subarray Sum; Min Stack; Evaluate Reverse Polish Notation

Output: Python solutions, state traces, reasoning, cost analysis, and boundary checks.

Week 3

Binary search and linked lists

Search a 2D Matrix; Search in Rotated Sorted Array; Reverse Linked List; Merge Two Sorted Lists

Output: Python solutions, state traces, reasoning, cost analysis, and boundary checks.

Week 4

Tree recursion, BFS, and BSTs

Maximum Depth of Binary Tree; Binary Tree Level Order Traversal; Validate Binary Search Tree; Kth Smallest Element in a BST

Output: Python solutions, state traces, reasoning, cost analysis, and boundary checks.

Week 5

Heaps, intervals, and graph traversal

Kth Largest Element in an Array; Merge Intervals; Number of Islands; Rotting Oranges

Output: Python solutions, state traces, reasoning, cost analysis, and boundary checks.