
Explore how core algorithms appear in interviews and real projects, from sorting and graph theory to testing and efficiency. Understand why strong fundamentals and problem solving drive software engineering success.
Master essential problem-solving for algorithms with a practical course approach: practice in rounds from easy to hard, use a to-do list, stay consistent, think actively, and manage effort and mindset.
Explore the Leetcode online judge by navigating problems by difficulty, checking acceptance ratios and frequency, reviewing solutions and editorials, and learning how to submit, test, and monitor runtime and memory.
Explore the Codeforces online judge with two-hour contests, division one and division two, and a rating system based on participation, including hacks, virtual contests, tutorials, and problems sorted by difficulty.
Explore recursion with factorial, where a problem's sub-problems share same type and halt at a base case. Show how factorial n equals n times factorial n-1 using a single function.
Explore recursive functions by printing the 3n+1 sequence from a starting number, handling even and odd steps with a base case at 1, and tracing for beginners.
Explore recursion fundamentals with factorial and array problems, mastering base cases, induction, and step-by-step tracing of functions like sum, average, and maximum.
Explore advanced recursive problems in c++, including right-max and left-max with a start_position parameter, suffix and prefix sums, palindrome checks, tracing, grid path sums, and fibonacci with two recursive calls.
Learn to compute the right maximum in an array with recursion, using a starting index and a frameless variant, then explore suffix and prefix sum ideas.
Convert a three-direction grid path problem into a recursive solution using direction arrays to pick the next cell with the maximum value, calling a best function until the base case.
Explore asymptotic complexity to estimate time and memory for algorithms by focusing on large N and dominant terms, learning common big O forms like O(n), O(n^2), and O(1).
Analyze practical time complexity with code examples, determine dominant terms, ignore constants, and classify Big O forms from O(1) to higher polynomial orders, noting nested vs parallel loops.
Explore the math behind big O by focusing on upper bounds, constants, and starting points, and compare worst, average, best, and amortised analyses for practical performance.
Learn to analyze space complexity alongside time, focusing on worst-case memory, dynamic allocations, and auxiliary space, with examples of O(n), O(n^2), and memory leaks.
Explore STL's intro sort hybrid of quick sort, heap sort, and insertion sort, and note how proper comparators and logical ordering prevent runtime errors.
Apply count sort to sort numbers by frequencies, using a frequency array from 0 to max value, achieving O(N+K) time and O(K) space, though not stable, adaptive, online, or in-place.
You may wonder why there is med to hard challenges
and later easy challenges
The first homework is about changing the sorting algorithm themselves
The later ones are about using the sorting algorithms
Apply a greedy analysis to maximize the sum by flipping signs with k, sort values, convert negatives to positives, and flip minimum when k is odd using the -2*min trick.
Sort the jobs and workers by difficulty; utilize history to accumulate profits while avoiding duplicate computations, achieving O(N log N + Q log N) time.
Combine batch processing with counting of unique lower values to reduce array elements. Sort from large to small and update all instances at once for an O(n log n) solution.
Explore generalizing binary search with a monotonic predicate and a virtual array of zeros and ones to guide the search and craft the possible function.
Explore three medium binary search challenges: smallest valid divisor with ceiling division; bloom-day simulation for adjacent bouquets; and minimum heater radius to cover all houses.
Solve binary search homework two by computing a monotonic summation over divisors and using ceiling division to find the smallest divisor whose sum meets the threshold.
Mastering critical skills in algorithms using C++ teaches binary search on days to determine minimum days to produce enough bouquets, using a monotonic possible function and a greedy grouping strategy.
Apply binary search to find the square root by comparing mid*mid with the target, starting from zero with an upper bound. Add a tiny 1e-9 epsilon and cast to int.
Discover how binary search generalizes to monotonic functions and arrays, handling overflow, first/last occurrences, and domain considerations, while mastering search patterns and complexity insights.
Explore graph theory by treating objects as nodes and relationships as edges, and learn to compute paths and shortest paths in maps, networks, and social media.
Discover how to represent graphs with an adjacency matrix, using a 2d vector, edges as matrix[i][j], and options for directed, undirected, weighted, and multiple edges, plus complexity insights.
convert real domains into standard graphs using adjacency lists, handling strings, weights, and multiple edges; sort by from, then to, then cost, and explore chains, grids, and two-edge paths.
Tackle two hard graph representation challenges using adjacency matrices in c++: implement a linear-time universal sink finder and interpret the square of a binary adjacency matrix.
Explain the universal sink problem and prove that at most one sink exists, then compare brute-force O(v) checks with an O(v) linear-time approach using an adjacency matrix.
Learn how to use the adjacency matrix to count paths of a given length by powering matrices, interpreting C[i][j], and exploring simple versus non-simple paths, cycles, and DAGs.
Learn the depth first search algorithm for graph traversal using recursion on adjacency lists to determine reachability and build a rooted dfs tree of reachable nodes.
Explore dfs tasks to return the subtree under a node in a rooted tree using pid and ppid, tally importance in employee graph, and count connected components in undirected graph.
Solve reachability problems using a hashmap-based graph with large node ids, and apply dfs on rooted trees with node weights to sum reachable values via id mapping.
Learn how to apply depth-first search to implicit and explicit graphs represented as 2d matrices, starting from a pixel to perform flood fill and recolor connected components.
Explore efficient grid dfs in matrices using direction arrays or nested loops to traverse 8 neighbors, with early validation and notes on recursion vs bfs and randomization for stability.
Master DFS on a matrix by solving four medium problems—sub islands, border coloring, closed islands, and cycle detection—using four-direction moves and connected components.
Learn to solve sub-island and border coloring problems with depth-first search. Implement standard dfs on grid2 to detect connectivity and sub-islands relative to grid1, using a visited array, then identify and recolor boundaries with a safe flood-fill approach.
Identify closed islands by checking boundary contact during dfs, assign connected component ids, and distinguish cycles using a parent-aware dfs to avoid false cycle detection.
Build an undirected graph from given index pairs, identify connected components with dfs, and rearrange letters within each component by sorting indices and letters to achieve the lexicographically smallest string.
Model the numbers as a graph by connecting consecutive values, then find the longest chain via DFS or iterative traversal. Handle duplicates, empty graphs, and start/end identification with degree-one nodes.
Binary search the limit to find the value that allows a path from start to end, using a DFS flood fill with four-direction moves and a difference constraint.
Learn to detect cycles in directed graphs with dfs by classifying edges as tree, forward, back, or cross, using started and finished times to identify ancestors and active stack.
Print paths from the starting node to every node using a parent array. Apply BFS to validate trees and find the shortest path to food in a 2D grid.
Solve the first BFS homework by building a parent array initialized to -1, then print the path from the start node to the target node, handling disconnected nodes with recursion.
Apply a grid-based breadth-first search to find the shortest path from start to hash, using a 2d visited matrix and a queue, with guidance on mutating input versus preserving it.
Model the jumping game as a graph to reach a zero-valued index. Use add, subtract, or xor on numbers 0–1000 and solve the wrap-around lock avoiding dead ends.
Master BFS using queue-based state processing, visited tracking, and eight neighbor transitions to solve number and lock puzzles, with memory and time analysis (O(MN)).
Implement a grid BFS with multi-source starting points, using queue size handling and visited marking, then apply reverse thinking to determine cells reachable from both Pacific and Atlantic edges.
Explore bfs-based graph problems, including alternating-color shortest paths, the water jug puzzle, sliding puzzle, and a box-and-keys candy collection challenge, with practical algorithmic insights and optimization notes.
Master the sliding puzzle as a graph problem by modeling states as strings, using a direction array to find neighbors, and solving with BFS.
Simulate opening boxes to collect keys and candies by modeling boxes as a graph and solving with multi-source BFS, tracking global status, visited boxes, and candies.
Tackle a shortest bridge problem on a binary matrix to link two islands with minimal zero flips, and explore the tree diameter of an unweighted graph using DFS or BFS.
Apply Kahn's algorithm to compute a topological ordering by counting indegrees and using a ready queue; handle disconnected graphs and detect cycles with O(V+E) time and O(V) space.
Explore topological sort to find all valid orders, determine the lexicographically smallest ordering among them, and compute the minimum number of semesters under prerequisites with unlimited parallel courses.
Convert sequences to a graph by treating adjacent numbers as edges, then apply topological sort to obtain the unique shortest supersequence; ensure uniqueness with a single-option queue.
Apply a topological sort inspired approach on undirected trees by removing leaves level by level. Find the diameter centers—the middle, one or two centroids—minimizing height.
Apply topological sort to compute completion times by propagating longest-path information through a graph. Use the completionTime vector to aggregate path data and update neighbors with a dynamic programming approach.
Push information along a directed acyclic graph by propagating each node’s color maxima to its neighbors, and keep the maximum per color to form the best path.
Almost all other courses focus on knowledge. In this course, we focus on gaining real skills.
Overall:
The course covers a good subset of algorthmic topics
Learn the inner details of the algorithms and their time & memory complexity analysis
Learn how to code line-by-line
Source code and Slides and provided for all content
An extensive amount of practice to master the taught algorithms (where most other content fails!)
Content of this part
Online Judges and How to use
Recursion: Basics Review
Complexity Analysis (Part 1)
Sorting: Insertion, Selection and Count
Binary Search: Basic and generalised forms
Graph Representation
Graph DFS
Graph BFS
Graph Topological Order
Extensive practice on these subjects
Philosophy of the course 2 parts:
The first part focus on topics that are more common in interviews
The first part focus on topics that require less proving skills. This allow you to sharpen problem-solving skills more first
In the next part we proceed toward other important topics in the Algorithms field.
Teaching Style:
Instead of long theory then coding style, we follow a unique style
I parallelize the concepts with the codes as much as possible
Go Concrete as possible
Use Clear Simple Visualization
Engagement
By the end of the journey
Solid understanding of Algorithms topics in C++
Mastering different skills
Analytical and Problem-Solving skills
Clean coding for algorithms
With the administered problem-solving skills
You can start competitive programming smoothly
A strong step toward interviews preparation
Prerequisites
Programming Skills:
Strong Programming skills
Solving a lot of basic problem-solving problems on fundamentals
Good understanding for basic recursion (E.g. Fibonacci)
STL, especially Vectors, map/set, unordered map/set
Highly Preferred:
Do programming projects
Finish a descent data structure course (extensive data structure practice)
Don't miss such a unique learning experience!
Acknowledgement: “I’d like to extend my gratitude towards Robert Bogan for his help with proofreading the slides for this course”