Advanced Algorithmic Problem Solving · HIT

CS 3xx · HIT · Advanced Elective · Year 3 · 13 Weeks

Advanced Algorithmic Problem Solving: From Theory to Competitive Programming

פתרון בעיות אלגוריתמיות מתקדם: מתיאוריה לתכנות תחרותי

Advanced algorithmic techniques, rigorous complexity reasoning, competitive programming practice, and software-engineering interview readiness

Format: 2 h lecture + 2 h guided practice Credits: 3.5 Prerequisites: data structures, graph theory, design and analysis of algorithms Assessment: assignments, in-class problem solving, technique portfolio, and final contest

About this course

This course uses competitive-programming frameworks, contest-style tasks, and LeetCode-style interview problems as applied laboratories for advanced algorithmic problem solving. Students learn to recognize problem structure, choose appropriate algorithmic techniques, prove correctness, analyze complexity, and implement robust solutions under realistic constraints.

The course combines formal algorithmic reasoning with extensive live demonstrations and in-class problem solving. Students study dynamic programming, graph algorithms, greedy methods, divide and conquer, data structures, string algorithms, search, optimization, and reductions. Each topic is taught through construct-matched problems in which the algorithmic idea, complexity bound, and implementation details are developed together.

Rationale. Algorithmic screening remains a central pathway into software-engineering roles, but interview readiness alone is too narrow for a third-year elective. This course uses that practical motivation to build stronger academic competence: abstraction, recurrence design, invariants, exchange arguments, graph modelling, state-space search, and disciplined complexity analysis.

Course format

Each week includes a 2-hour lecture and a 2-hour practice session. The lecture introduces the technique, mathematical structure, proof method, complexity model, and common failure modes. The practice session is an active problem-solving lab: the instructor demonstrates solution discovery, students solve related tasks in pairs or small teams, and the class compares approaches using a shared analysis checklist.

Problem ModellingInput constraints, state design, invariants, graph transformations, and reduction to known patterns.
Algorithmic TechniquesDynamic programming, greedy methods, divide and conquer, search, optimization, and randomized thinking.
Data StructuresHeaps, union-find, Fenwick trees, segment trees, monotonic queues, tries, and hash-based structures.
Graphs and StringsShortest paths, MST, flows, SCCs, topological order, KMP, rolling hash, suffix ideas, and tries.
Complexity and ProofAsymptotic analysis, amortization, correctness proofs, exchange arguments, recurrences, and lower-bound intuition.
Interview ReadinessLeetCode-style pattern recognition, explanation under pressure, edge cases, testing, and clean code.

Expected outcomes

By the end of the course, students will be able to:

1Translate informal problem statements into precise computational models.
2Select algorithmic techniques based on constraints, structure, and target complexity.
3Design dynamic programs using states, transitions, base cases, and reconstruction.
4Apply graph algorithms to shortest paths, connectivity, ordering, matching-style modelling, and flows.
5Use advanced data structures to reduce asymptotic cost in online and range-query problems.
6Prove greedy algorithms with exchange arguments, cut properties, and matroid-style intuition.
7Analyze time and memory complexity, including amortized and pseudo-polynomial bounds.
8Implement solutions that handle edge cases, large inputs, and strict runtime limits.
9Explain algorithmic choices clearly in a technical-interview setting.
10Read contest/editorial solutions critically and map them to underlying CS principles.

Academic foundations

The course strengthens the theoretical spine behind contest-style problem solving. Students must state the invariant, prove the algorithmic step, justify the selected data structure, and connect the implementation to the complexity claim.

ACorrectness. Loop invariants, induction, exchange arguments, optimal substructure, and graph cut properties.
BComplexity. Worst-case analysis, amortized analysis, recurrence solving, bit complexity awareness, and memory tradeoffs.
CModelling. State-space construction, graph representation, constraint exploitation, and reductions between problem forms.
DOptimization. Binary search on answer, pruning, dominance, monotonicity, and dynamic-programming optimization patterns.

Industry alignment

The course directly supports preparation for algorithmic interviews and online screening platforms while keeping the academic level appropriate for an advanced CS elective. Students practice not only solving, but also explaining, testing, and comparing solutions.

Prerequisites: review and self-check

The course assumes students can already program fluently and have completed core algorithmic foundations. The first week includes a diagnostic problem set so students can identify review needs early.

SubjectBackground topicsMaterial
Data structures arrays, lists, stacks, queues, trees, hash tables, heaps, balanced trees, union-find ReviewPractice
Algorithms sorting, searching, recursion, graph traversal, shortest paths, asymptotic notation, correctness proofs ReviewVisualize
Programming C, C++, Java, C#, or Python fluency, standard library containers, debugging, and test-case construction ReviewPractice

Weekly materials

Each week combines algorithmic theory with a problem-solving lab. Example platforms are listed as practice sources, but grading emphasizes reasoning, correctness, and technique transfer rather than platform completion alone.

Weekly plan and study resources
Part I · Modelling, Complexity, and Search
Week 1
From Contest Statements to Computational Models Lecture Constraint reading, input size, brute-force baselines, invariants, edge cases, and solution narratives. Practice Diagnose problems by constraint class; produce brute-force and optimized approaches for the same task. Tools C++17 or Python · online judge workflow · local tests
Concepts and algorithms asymptotic notation, input constraints, brute-force baselines, hashing, sorting, two pointers, loop invariants. Use when the main challenge is recognizing the right model and improving a direct solution from O(n squared) to O(n log n) or O(n). Libraries arrays, vectors or lists, hash maps, hash sets, sorting, local test harness. Problem samples Two Sum, Valid Anagram, Merge Intervals, Container With Most Water.
Reading Competitive Programmer's Handbook, chapters 1 to 3.Deliverable Diagnostic problem set with written complexity explanations.
Week 2
Exhaustive Search, Backtracking, and Pruning Lecture State spaces, recursion trees, branch and bound, bitmasks, meet-in-the-middle, and correctness by enumeration. Practice Solve subset, permutation, scheduling, and constraint-satisfaction tasks. Tools recursion tracing · bit operations · memoized search
Concepts and algorithms recursion trees, backtracking templates, bitmask enumeration, pruning, branch and bound, meet-in-the-middle. Use when constraints are small, outputs are exponential, or the problem asks for all feasible objects. Libraries recursive functions, boolean visited arrays, bit operations, stack traces, sorted candidates for pruning. Problem samples Subsets, Permutations, Combination Sum, N-Queens.
Reading CLRS, recursion and divide-and-conquer review.Practice One exact search solution with pruning justification.
Part II · Dynamic Programming and Optimization
Week 3
Dynamic Programming I: States, Transitions, and Reconstruction Lecture Optimal substructure, overlapping subproblems, top-down versus bottom-up, path reconstruction, and memory compression. Practice Sequence DP, grid DP, knapsack variants, and edit-distance style problems. Tools memoization tables · tabulation · reconstruction arrays
Concepts and algorithms state definition, transitions, base cases, top-down memoization, bottom-up tabulation, reconstruction. Use when a problem has overlapping subproblems and an optimal answer can be composed from smaller states. Libraries arrays, matrices, dictionaries for sparse states, sentinel values, parent pointers. Problem samples Climbing Stairs, House Robber, Unique Paths, Coin Change.
Deliverable DP state design worksheet with recurrence and complexity.
Week 4
Dynamic Programming II: Advanced Patterns Lecture Interval DP, tree DP, bitmask DP, digit DP, monotonicity, and pseudo-polynomial algorithms. Practice Compare multiple DP formulations for the same problem and choose the strongest one. Tools bitmask tables · parent pointers · state compression
Concepts and algorithms interval DP, two-sequence DP, bitmask DP, pseudo-polynomial DP, memory compression, LIS optimization. Use when the natural state includes intervals, subsets, two indices, or a bounded numeric capacity. Libraries bit masks, nested vectors or arrays, binary search helpers, compact state encodings. Problem samples LIS, LCS, Partition Equal Subset Sum, Burst Balloons.
Practice Two advanced DP problems with written recurrence derivation.
Part III · Greedy, Divide and Conquer, and Data Structures
Week 5
Greedy Algorithms and Exchange Arguments Lecture Greedy choice, exchange proofs, cut properties, interval scheduling, Huffman coding, and counterexamples. Practice Build proof sketches and test greedy hypotheses against adversarial cases. Tools priority queues · sorting · proof checklist
Concepts and algorithms greedy choice, exchange proof, cut property, interval scheduling, Huffman-style merging, counterexample search. Use when a locally best step can be proven never to hurt a global optimum. Libraries sorting with custom comparators, priority queues, heaps, interval records. Problem samples Jump Game, Non-overlapping Intervals, Task Scheduler, Minimum Arrows.
Deliverable Greedy solution with exchange proof.
Week 6
Divide and Conquer, Binary Search on Answer, and Recurrences Lecture Recurrence analysis, monotonic predicates, parametric search, mergesort-style counting, and selection. Practice Solve inversion counting, closest-pair variants, and feasibility-search tasks. Tools recurrence trees · monotonic predicates · two-sided tests
Concepts and algorithms divide and conquer, recurrence analysis, merge-counting, binary search on answer, monotone feasibility predicates. Use when the solution space is ordered, a predicate is monotone, or recursive splitting exposes useful counts. Libraries binary search helpers, stable merge logic, recursion templates, integer-boundary tests. Problem samples Koko Eating Bananas, Rotated Search, Count Smaller, Median of Two Sorted Arrays.
Practice One divide-and-conquer counting problem and one answer-search problem.
Week 7
Advanced Data Structures for Problem Solving Lecture Union-find, Fenwick trees, segment trees, sparse tables, monotonic stacks, monotonic queues, and heaps. Practice Transform O(n squared) scans into O(n log n) or O(n) data-structure solutions. Tools Fenwick tree · segment tree · union-find · deque
Concepts and algorithms Fenwick trees, segment trees, union-find, monotonic stacks, monotonic queues, sparse tables, heaps. Use when repeated updates, range queries, nearest-greater queries, or dynamic components dominate the runtime. Libraries priority queue, deque, stack, DSU class, Fenwick class, segment-tree class. Problem samples Range Sum Query Mutable, Sliding Window Maximum, Daily Temperatures, Accounts Merge.
Deliverable Data-structure comparison table for three range-query tasks.
Part IV · Graphs and Strings
Week 8
Graph Modelling and Traversal Patterns Lecture BFS, DFS, topological sorting, connected components, bipartite graphs, shortest unweighted paths, and implicit graphs. Practice Model non-graph statements as graphs and compare adjacency representations. Tools BFS queue · DFS stack · topo order · grid graphs
Concepts and algorithms BFS, DFS, connected components, bipartite tests, topological sorting, implicit graphs, grid graphs. Use when the problem contains reachability, dependency ordering, shortest unweighted paths, or state transitions. Libraries adjacency lists, queues, stacks, visited sets, indegree arrays, coordinate-direction arrays. Problem samples Course Schedule, Rotting Oranges, Pacific Atlantic Water Flow, Word Ladder.
Practice One implicit graph problem and one dependency-order problem.
Week 9
Shortest Paths, Spanning Trees, SCCs, and Flow Ideas Lecture Dijkstra, Bellman-Ford, Floyd-Warshall, MSTs, strongly connected components, and maximum-flow modelling. Practice Choose the correct graph algorithm from weights, constraints, and required output. Tools priority queue · DSU · SCC decomposition · residual graph intuition
Concepts and algorithms Dijkstra, Bellman-Ford, Floyd-Warshall, MSTs, bridges, SCCs, residual-network intuition. Use when graph edges have weights, all-pairs distances, connectivity structure, or minimum connection cost matters. Libraries priority queue, edge list, adjacency list, DSU, timestamp arrays, distance arrays. Problem samples Network Delay Time, Cheapest Flights, Critical Connections, Min Cost to Connect All Points.
Deliverable Graph algorithm selection memo for a mixed problem set.
Week 10
String Algorithms and Hashing Lecture Prefix functions, KMP, rolling hash, tries, suffix-array intuition, and string DP connections. Practice Solve pattern matching, dictionary, palindrome, and repeated-substring problems. Tools prefix function · trie · rolling hash · collision tests
Concepts and algorithms tries, prefix function, KMP, rolling hash, suffix intuition, sliding-window counts, collision risk. Use when the input is text, prefixes, repeated substrings, dictionaries, pattern matching, or many string queries. Libraries maps or fixed arrays for trie children, prefix arrays, modular arithmetic, string slicing care. Problem samples Implement Trie, Find All Anagrams, Repeated DNA Sequences, Longest Duplicate Substring.
Practice Implement one exact matcher and one hash-based solution with collision discussion.
Part V · Integration, Interviews, and Final Competition
Week 11
Optimization Patterns and Hardness Awareness Lecture NP-completeness awareness, reductions, approximation intuition, heuristics, dominance pruning, and when exact solutions are impossible. Practice Classify tasks as polynomial, pseudo-polynomial, exponential with pruning, or likely intractable. Tools reduction sketches · lower-bound reasoning · benchmark inputs
Concepts and algorithms NP-completeness awareness, reductions, pseudo-polynomial DP, exact search, state compression, dominance pruning. Use when constraints rule out known polynomial techniques and the task resembles partitioning, covering, Hamiltonian search, or SAT-like choices. Libraries bit masks, memoized search, BFS over compressed states, benchmark generators. Problem samples Partition to K Equal Sum Subsets, Sudoku Solver, Shortest Path Visiting All Nodes, Word Ladder II.
Deliverable Complexity classification note for three hard-looking problems.
Week 12
Technical Interview Simulation and Solution Communication Lecture Problem clarification, examples, brute-force baseline, optimization path, correctness explanation, testing, and follow-up variants. Practice Timed whiteboard-style and keyboard-style interviews with peer review. Tools interview rubric · edge-case checklist · code-review checklist
Concepts and algorithms clarification questions, baseline-first explanation, design invariants, follow-up variants, tests, tradeoff comparison. Use when the goal is to communicate a solution under time pressure and adapt it to changing constraints. Libraries hash maps, linked lists, heaps, queues, tree traversal helpers, unit tests. Problem samples LRU Cache, Merge k Sorted Lists, Serialize Binary Tree, Trapping Rain Water.
Deliverable Recorded or live explanation of one medium-hard problem.
Week 13
Final Internal Competition and Reflective Analysis Lecture Contest briefing, scoring rules, team strategy, and post-contest editorial analysis. Practice Internal programming contest followed by solution walkthroughs and individual reflection. Tools online judge · team repository · editorial template
Concepts and algorithms mixed-technique selection, contest strategy, 0-1 BFS, sweep line, heap events, reconstruction, post-contest editorial analysis. Use when the problem combines several patterns and the team must choose an approach quickly. Libraries team template, fast input, priority queue, deque, graph helpers, local stress tests. Problem samples Skyline Problem, Swim in Rising Water, Minimum Cost Valid Path, Word Ladder II.
Deliverable Final contest submission package and post-contest technique reflection.

Assessment

The assessment combines practical problem-solving performance with explicit academic evidence: students submit solutions, proofs, complexity analyses, and reflections that show technique transfer.

ComponentWhat is evaluatedWeight
Homework problem setsCorrectness, asymptotic analysis, readable implementation, and explanation quality across five submitted sets.30%
In-class problem solvingActive participation in guided labs, peer explanation, debugging discipline, and technique comparison.20%
Technique portfolioA curated set of solved problems with state design, proof sketches, complexity analysis, tests, and interview-style explanations.20%
Final internal competitionTeam contest performance, post-contest editorial analysis, and individual reflection on strategy and technique selection.30%
Total100%

Video references

These video sources support the weekly plan. English academic sources are preferred for core theory; Hebrew sources are included for terminology support, review, and local study context.

English
MIT 6.006 Introduction to Algorithms · MIT OpenCourseWare

Complete lecture-video sequence covering modelling, data structures, graph algorithms, dynamic programming, and complexity.

English
MIT 6.046J Design and Analysis of Algorithms · MIT OpenCourseWare

Advanced video lectures and recitations for divide and conquer, greedy algorithms, flows, approximation, and NP-completeness.

English
Algorithms 1 · Tim Roughgarden, YouTube

Free lecture playlist covering asymptotic notation, divide and conquer, sorting and searching, and randomized algorithms.

English
Algorithms 2 · Tim Roughgarden, YouTube

Free lecture playlist covering graph search, shortest paths, data structures, greedy algorithms, MSTs, and dynamic programming.

English
MIT 6.006 YouTube playlist · MIT OpenCourseWare on YouTube

Same 6.006 sequence in a convenient playlist format for weekly video assignment.

Hebrew
אלגוריתמים תשפ"א סמסטר א · Guy Tordjman, YouTube

Hebrew algorithm practice playlist with graph traversal, shortest paths, greedy algorithms, and dynamic programming.

Hebrew
מבני נתונים, תרגולים · Ido Galil, YouTube

Hebrew data-structures tutorial playlist covering complexity, recurrences, trees, union-find, tries, and amortized analysis.

Hebrew
מבני נתונים, חלק ב: אלגוריתמים בגרפים · Campus IL

Free self-paced Hebrew graph-algorithms course from Campus IL, covering BFS, DFS, components, MSTs, shortest paths, and SCCs.

References

The course uses open online material, official contest archives, and standard algorithmic texts. Students are expected to read editorials critically and connect them to lecture concepts.

Core
CP-Algorithms · open reference

Concise algorithm explanations and implementations for most course topics.

Book
Competitive Programmer's Handbook · Antti Laaksonen

Free book covering core contest techniques and CSES-style practice.

Theory
Introduction to Algorithms · Cormen, Leiserson, Rivest, Stein

Primary theoretical reference for proofs, graph algorithms, dynamic programming, and complexity.

Course
MIT 6.006 · OpenCourseWare

Supplementary lectures for algorithmic foundations and data structures.

Practice
LeetCode · interview practice

Used selectively for interview-style pattern recognition and explanation practice.

Contest
ICPC · contest archive

International contest context and source of advanced team-problem examples.

Contest
IEEEXtreme · contest archive

Programming-contest setting with timed team problems and algorithmic challenge archives.

Practice
CSES Problem Set · structured archive

Well-organized problems for progressive practice across the course topics.

Tools and resources