Build your algorithmic thinking foundation
Section 1 of 5
Master the essential algorithm design techniques that form the backbone of computer science. Learn when and how to apply different paradigms to solve complex computational problems efficiently.
An algorithm is a step-by-step finite set of instructions to solve a well-defined computational problem. It is a precise plan for performing a sequence of actions.
Zero or more quantities externally supplied
At least one quantity is produced
Each instruction must be clear and unambiguous
Algorithm terminates after finite steps for all cases
Every instruction sufficiently basic to be carried out
Makes locally optimal choices without considering future consequences
Dijkstra's algorithm, Prim's algorithm
When locally optimal choice leads to globally optimal solution
Divides problem into smaller subproblems, solves recursively, then combines
Quick sort, Merge sort, Binary search
When problem can be broken into similar smaller problems
Solves overlapping subproblems by storing solutions in optimal structure
Fibonacci series, Knapsack problem
When subproblems overlap and optimal substructure exists
Tries all possible solutions until finding the optimal one
Linear search algorithm
When problem size is small or no better algorithm exists
Explores all possible solutions and backtracks when solution isn't optimal
N-Queens problem, Sudoku solver
When need to find all solutions or constraint satisfaction problems
Systematically explores solution space with pruning of suboptimal branches
Traveling salesman problem
For optimization problems where bounds can be computed