CS 3xx · HIT · Advanced Elective · Year 3 · 13 Weeks
פתרון בעיות אלגוריתמיות מתקדם: מתיאוריה לתכנות תחרותי
Advanced algorithmic techniques, rigorous complexity reasoning, competitive programming practice, and software-engineering interview readiness
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.
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.
By the end of the course, students will be able to:
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.
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.
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.
| Subject | Background topics | Material |
|---|---|---|
| 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 |
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.
LeetCode problemsAnnotated modelling setAlgorithm tutorialCompetitive Programmer's Handbook, chapters 1 to 3Watch listEN: Algorithms and computationHE: Complexity
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.
LeetCode problemsAnnotated backtracking setBacktracking tagAlgorithm tutorialSubmask enumerationWatch listEN: BacktrackingHE: Data structures tutorials
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.
LeetCode problemsAnnotated DP foundations setDynamic programming tagAlgorithm tutorialIntroduction to DPWatch listEN: Dynamic programming IHE: Dynamic programming
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.
LeetCode problemsAnnotated advanced DP setDynamic programming tagAlgorithm tutorialProfile dynamicsUSACO Guide: Dynamic programmingWatch listEN: Dynamic programming IIHE: DP variants
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.
LeetCode problemsAnnotated greedy setGreedy tagAlgorithm tutorialScheduling with deadlinesWatch listEN: Greedy examplesHE: Greedy and Huffman
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.
LeetCode problemsAnnotated search and divide setBinary search tagAlgorithm tutorialBinary search and answer searchWatch listEN: Divide and conquer recitationEN: Recurrences
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.
LeetCode problemsAnnotated data-structures setMonotonic stack tagAlgorithm tutorialFenwick treeSegment treeWatch listEN: Fenwick treesHE: Union Find
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.
LeetCode problemsAnnotated graph traversal setGraph tagAlgorithm tutorialBreadth-first searchTopological sortWatch listEN: Depth-first searchHE: Algorithms playlist
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.
LeetCode problemsAnnotated weighted-graph setGraph tagAlgorithm tutorialDijkstraKruskal MSTStrongly connected componentsWatch listEN: DijkstraHE: Bellman-Ford and APSP
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.
LeetCode problemsAnnotated string algorithms setString tagAlgorithm tutorialPrefix functionString hashingWatch listEN: KMP and string searchHE: Strings, tries, and suffixes
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.
LeetCode problemsAnnotated hard-problem setAlgorithm tutorialNP-completeness notes2-SATWatch listEN: P, NP, and reductionsHE: Algorithms course
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.
LeetCode problemsAnnotated interview simulation setAlgorithm tutorialInterview algorithm cheatsheetWatch listEN: Mock coding interviewHE: Data structures interview review
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.
LeetCode problemsAnnotated final contest setAlgorithm tutorial0-1 BFSMonotonic queueWatch listEN: Competitive programming roadmapHE: Algorithms review playlist
Deliverable Final contest submission package and post-contest technique reflection.
|
The assessment combines practical problem-solving performance with explicit academic evidence: students submit solutions, proofs, complexity analyses, and reflections that show technique transfer.
| Component | What is evaluated | Weight |
|---|---|---|
| Homework problem sets | Correctness, asymptotic analysis, readable implementation, and explanation quality across five submitted sets. | 30% |
| In-class problem solving | Active participation in guided labs, peer explanation, debugging discipline, and technique comparison. | 20% |
| Technique portfolio | A curated set of solved problems with state design, proof sketches, complexity analysis, tests, and interview-style explanations. | 20% |
| Final internal competition | Team contest performance, post-contest editorial analysis, and individual reflection on strategy and technique selection. | 30% |
| Total | 100% | |
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.
Complete lecture-video sequence covering modelling, data structures, graph algorithms, dynamic programming, and complexity.
Advanced video lectures and recitations for divide and conquer, greedy algorithms, flows, approximation, and NP-completeness.
Free lecture playlist covering asymptotic notation, divide and conquer, sorting and searching, and randomized algorithms.
Free lecture playlist covering graph search, shortest paths, data structures, greedy algorithms, MSTs, and dynamic programming.
Same 6.006 sequence in a convenient playlist format for weekly video assignment.
Hebrew algorithm practice playlist with graph traversal, shortest paths, greedy algorithms, and dynamic programming.
Hebrew data-structures tutorial playlist covering complexity, recurrences, trees, union-find, tries, and amortized analysis.
Free self-paced Hebrew graph-algorithms course from Campus IL, covering BFS, DFS, components, MSTs, shortest paths, and SCCs.
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.
Concise algorithm explanations and implementations for most course topics.
Free book covering core contest techniques and CSES-style practice.
Primary theoretical reference for proofs, graph algorithms, dynamic programming, and complexity.
Used selectively for interview-style pattern recognition and explanation practice.
Programming-contest setting with timed team problems and algorithmic challenge archives.
Well-organized problems for progressive practice across the course topics.