Algorithms and projects
Measuring how fast code is, sorting and searching, useful patterns for lists, and two complete programs that bring the course together.
About 9 hours of study
Learning objectives
- Compare algorithms using Big O notation
- Use and explain sorting algorithms
- Apply two pointers and sliding windows
- Plan and build a complete small program
Lessons
- 1
How fast is your code? Intermediate
Count the steps a program takes, compare linear and binary search, and meet O(n) and O(n²).
- 2
Sorting algorithms Intermediate
Watch bubble sort and selection sort move values, then sort anything with sorted() and a key.
- 3
Two pointers and sliding windows Intermediate
Solve list problems in one pass by moving two positions through the data.
- 4
Project: a grade book Intermediate
Combine dictionaries, functions, loops and formatting into one small, complete program.
- 5
Project: a shop inventory Intermediate
Design a small class around a dictionary, with methods that keep the stock correct.
- 6
What comes next
Review what you have learned, try one last classic program, and choose your next course.
Module practice
- Is it on the list?Easy
- Binary searchMedium
- Pairs with a given sumMedium
- Two values, one passHard
- Words by lengthEasy
- Sort it yourselfMedium
- Rank the studentsMedium
- Merge sort and inversionsHard
- Reverse in placeEasy
- Pair with a given sumMedium
- Longest stretch with no repeatsHard
- How many passed?Easy
- Grade book reportMedium
- A ranked grade bookHard
- Total stock valueEasy
- Inventory commandsMedium
- An inventory with its own errorsHard
- FizzBuzz in PythonEasy
- FizzBuzzBangMedium
- A tiny programming languageHard