Class 1 – Introduction
Class Material and Notes
Independent Activity
Revise Concepts Covered in Python Level 1 and Level 2
Revise the Level 1 and Level 2 Projects
A (very) quick Introduction to Google COLAB
Website Structure: Class Project and the Homework COLAB Notebook
How to submit HOMEWORK for evaluation?
How to join the Discussion Forum on GITHUB
Class 2 – Fun with Numbers
Class Videos
- Introduction and Learning Goals
- A naive algorithm to test for primality
- Runtime of the naive algorithm for primality
- An efficient algorithm to determine primality
- Runtime of the efficient algorithm for Primality
- A naive algorithm to get a list of ALL prime numbers
- Runtime of the naive algorithm to get a list of ALL primes
- A Naive algorithm to compute GCD of two numbers
- Runtime of the naive algorithm to compute GCD of two numbers
- Euclid’s algorithm for efficient GCD computation
- Runtime for the efficient GCD computation algorithm
- The KEY message — naive algorithms are often not efficient
Enhancement Ideas/Videos
Class Material and Notes
Class Notes , Class Project (COLAB),
- Algorithms for prime numbers, GCD.
- Notion of Naive algorithms
- Study of efficiency in algorithms
Class 3 – Time to Search
Class Videos
- Introduction and Learning Goals
Linear Search - Linear Search: Concept and Code
- Correctness and Efficiency of Linear Search
- Python Commands that do Linear Search
- Search options for sorted data
Jump Search - Concept, Intuition and cases of interest
- Jump Search: Implementation in code
- Jump Search: Complexity Analysis
- Jump Search: Optimal Choice for the Jump
Binary Search - Binary Search: The Intuition
- Binary Search: Implementation in Code
- Binary Search: Cases of interest
- Why Floor Division and not normal division
- Why low = mid + 1, high = mid – 1 (why +1/-1)
- Why low <= high in the while loop?
- Complexity Analysis of Binary Search (Log complexity)
- Compare Linear Search, Jump Search, Binary Search
Class Material and Notes
Class Notes
Class Project (COLAB),
Key Learning Objectives
- Linear, Jump and Binary Search
- How, from a complexity perspective, binary search wins for sorted data!
Class 4 – Applications of Binary Search
Class Videos
Flight Path Problem
3. Why/How Binary Search can be used for the Flight Path Problem
4. Binary Search code for the Flight Path Problem
5. An alternative implementation of Binary Search for Flight Path Problem
Peak Search Problem
6. Problem Statement
7. Why/How Binary Search can be used for the Peak Search Problem
8. Binary Search Code for solving the peak search problem
Shipping Capacity Problem
9. Problem Statement
10. Why/How Binary Search for the Shipping Capacity Problem
11. Helper function
12. Binary Search to find the LEAST shipping capacity
Important Principles
13. Two Conditions for problems where Binary Search Can be applied
Class Material and Notes
Key Learning Objectives
- Applying binary search to interesting search problems.
Class 5 – The Two Pointers Technique
Class Videos
- Introduction and Learning Goals
Pair Sum Problem - Pair Sum Problem Statement
- Naive algorithm
- Complexity Analysis of the Naive algorithm O(N-squared)
- Discussion on Improving the Efficiency
- Smart Solution (Two Pointer Technique)
- Code for the Two pointer technique
- Two pointer technique has O(N) complexity
Merge Sorted Lists - Problem Statement
- Approaches to solve
- Two Pointer Technique (Intuition)
- Two Pointer Technique (Code)
Carpet Area Problem - Problem Statement
- Naive Solution
- Two Pointer technique (Intuition)
- Two Pointer technique (Code)
Summary - Summary and Key highlights of the Two Pointer technique
Class Material and Notes
Key Learning Objectives
- Two pointer techniques to increase efficiency of algorithms
Class 6 – Midterm Revision and Quiz.
Class Material (Live Quiz)
Key Learning Objectives
- Revise the concepts covered so far with an interactive quiz.
- More discussion on the Big-O notation.
Class 7 – Sliding Window Algorithms
Class Videos
- Introduction and Learning Goals
Sub-Array Sum problem - Problem Statement
- Naive algorithm for the Sub-Array Sum problem
- Complexity of the Naive algorithm is O(N-squared)!
- Intuition for Fixed Size Sliding Window
- CODE for Fixed Size Sliding Window using WHILE loop
- Alternate CODE for Fixed Size Sliding Window using FOR loop
- Fixed size sliding window is O(N)
Shortest Sub-Array for a given sum - Problem Statement
- Naive Solution
- Variable size Sliding Window intuition
- Variable Sliding Window Code 1
- Closer Analysis
- CODE using FOR LOOP
- Example Problems from Olympiads
Shortest Sub-string Problem - Problem Statement
- Comparison with the shortest SubArray problem
- Illustration of the solution
- Code
- What happens if the subarray or the substring is NOT found?
Class Material & Notes
Key Learning Objectives
- Introduction to the sliding window techniques
- Problems solved with sliding windows.
Class 8 – Basic Sorting Algorithms
Class Videos
Class Material and Notes
Key Learning Objectives
- Basic Sorting Algorithms
- Selection Sort, Insertion Sort, Bubble Sort and their variations.
Class 9 – Binary Trees and Heaps
Class Videos
- Introduction and Learning Goals
Binary Trees - A very quick introduction to Trees
- Perfect Binary Trees
- The notion of complete trees
- Imposing a Tree Structure on lists
- Child and Parent Indices
Heaps - Introducing Heaps
- Determining if a list is a heap or not. (Intuition)
- Determining if a list is a heap or not. (Code)
Heapify - Intuition behind Heapify
- Heapify using heapq module
- Complexity of Heapify operation is O(N)
- Comparing Heapify, Sorting and Min Finding
Priority Queue Problem - Hospital ER Waiting Room (Priority queue) Problem Statement
- Analysis of options to solve the priority queue problem
- Heaps based solution for the priority queue problem
- Handling new arrival with heappush
- Handling root extraction with heappop
- Restoring the Heap structure after a customer walks away
Summary - Summary of Heaps
Class Material
Class Notes, Class Project
Code to Visualize (REPLIT)
Key Learning Objectives
- Tree Data structure
- Heaps — min/max
- Important heap operations
- Priority Queues
Class 10 – Applying Heaps
Class Videos
Class Material
Key Learning Objectives
- Applying min/max heaps to solve problems
- Using python heapq module functions
Bonus Videos
Independent Activity
Apply heaps to solve interesting problems, eg sorting, live leaderboard, running median etc.