Algorithm Design
Everything on SkillVeris tagged Algorithm Design — collected across the glossary, study notes, blog, and cheat sheets.
21 resources across 1 library
Interview Questions(21)
Greedy vs Dynamic Programming: What is the Difference?
Greedy algorithms make the locally optimal choice at each step and never reconsider it, while dynamic programming explores overlapping subproblems and combines…
What is Backtracking?
Backtracking is a systematic search technique that builds a solution incrementally, one choice at a time, and abandons ("backtracks" from) any partial path as…
How Do You Prove a Greedy Algorithm is Correct?
Greedy algorithm correctness is typically proven with the exchange argument (show any optimal solution can be transformed into the greedy solution without losi…
What is the Divide and Conquer Strategy?
Divide and conquer is an algorithm design strategy that breaks a problem into smaller independent subproblems of the same type, solves each subproblem recursiv…
What is Exponential Search?
Exponential search finds a target in a sorted array by first doubling an index (1, 2, 4, 8, ...) until it finds a range that must contain the target, then runn…
What is Interpolation Search?
Interpolation search finds a target in a sorted, uniformly distributed numeric array by estimating the target's likely position using linear interpolation of i…
What is Jump Search?
Jump search finds a target in a sorted array by jumping forward in fixed-size blocks of size √n until it finds a block that could contain the target, then doin…
How Would You Build Autocomplete Using a Trie?
You build autocomplete by inserting every candidate string into a trie character by character, then for a typed prefix you walk the trie to the node matching t…
How Do You Construct a Suffix Array?
A suffix array is built by generating every suffix of a string, sorting those suffixes lexicographically, and storing only their starting indices, which naive…
How Do You Find the Longest Palindromic Substring?
The expand-around-center approach finds the longest palindromic substring in O(n²) time and O(1) extra space by treating every index (and every gap between ind…
How Do You Solve the Palindrome Partitioning Problem?
Palindrome partitioning — splitting a string into the minimum number of cuts so every resulting piece is a palindrome — is solved with dynamic programming in O…
How Does Matrix Chain Multiplication Work?
Matrix chain multiplication finds the cheapest order to parenthesize a chain of matrix multiplications — not the product itself — using dynamic programming in…
What is the Activity Selection Problem?
The activity selection problem is the classic greedy exercise of choosing the maximum number of non-conflicting activities from a set given each activity's sta…
How Does Greedy Choice Relate to Optimal Substructure?
A greedy algorithm only produces a globally optimal solution when a problem has both the greedy-choice property — a locally optimal choice at each step leads t…
What are Approximation Algorithms and When Do You Use Them?
An approximation algorithm trades exact optimality for polynomial-time runtime by finding a solution provably within a bounded factor of the optimal — such as…
What are Randomized Algorithms?
A randomized algorithm makes some of its decisions using random numbers, trading a guaranteed worst case for a strong expected-case guarantee or a simpler impl…
What are Online Algorithms?
An online algorithm processes its input piece by piece in the order it arrives, committing to each decision immediately without knowledge of future input, in c…
What are Cache-Oblivious Algorithms?
A cache-oblivious algorithm is designed to use the memory hierarchy — CPU caches, RAM, and disk — efficiently without knowing any cache size or block size as a…
In-Place vs Out-of-Place Algorithms: What is the Difference?
An in-place algorithm transforms its input using only O(1) or O(log n) extra memory beyond the input itself, typically by overwriting the input structure direc…
Online vs Offline Algorithms: What is the Difference?
An online algorithm processes input piece by piece as it arrives, making irrevocable decisions without knowledge of future input, while an offline algorithm ha…
What is Belady’s Anomaly?
Belady’s Anomaly is the counter-intuitive situation where increasing the number of page frames available to a process actually increases the number of page fau…