ALGORITHMS

A reference manual for people who design and analyze algorithms.


ALG.000

MAIN FOCUS:
Design and analysis of efficient algorithms.

Algorithms are step-by-step procedures for solving computational problems. This reference provides a concise overview of major algorithmic paradigms, their applications, complexity analysis, and implementation details.

Your browser does not support SVG
[ 1.0 INTRO ]
ALG.001

Algorithm Complexity

A measure of how long an algorithm would take to complete given an input of size n.

Key Points:

  • Big O: Algorithm's worst-case complexity
  • Time Complexity: How long it will take to execute an algorithm as a function of its input size.
  • Space Complexity: Total amount of space or memory required to execute an algorithm as a function of the size of the input.

Time Complexity:

  • Constant: O(1)
  • Linear time: O(n)
  • Logarithmic time: O(n log n)
  • Quadratic time: O(n^2)
  • Exponential time: O(2^n)
  • Factorial time: O(n!)

Performance:

  • O(1) - Excellent/Best
  • O(log n) - Good
  • O(n) - Fair
  • O(n log n) - Bad
  • O(n^2), O(2^n) and O(n!) - Horrible/Worst
[ 2.1 D&C ]
↑ Top
ALG.002

Divide and Conquer

A paradigm that solves a problem by breaking it into smaller subproblems, solving each recursively, then combining the results.

Key Algorithms:

  • Merge Sort
  • Quick Sort
  • Binary Search
  • Strassen's Matrix Multiplication

Time Complexity:

Often O(n log n) for sorting algorithms

[ 2.1 D&C ]
↑ Top
ALG.003

Randomization

Algorithms that use random numbers to achieve good expected performance regardless of input.

Key Algorithms:

  • Randomized Quicksort
  • Randomized Selection
  • Monte Carlo Methods
  • Las Vegas Algorithms

Time Complexity:

Expected O(n log n) for randomized sorting

[ 2.2 RAND ]
↑ Top
ALG.004

Dynamic Programming

A method for solving complex problems by breaking them down into simpler subproblems and storing their solutions to avoid redundant computation.

Key Algorithms:

  • Fibonacci Sequence
  • Longest Common Subsequence
  • Knapsack Problem
  • Matrix Chain Multiplication

Time Complexity:

Usually polynomial time, depending on problem dimensions

[ 2.3 DP ]
↑ Top
ALG.005

Data Structures

Specialized formats for organizing and storing data to enable efficient access and modification.

Key Data Structures:

  • Hash Tables
  • Binary Trees
  • Heaps
  • Balanced Search Trees

Time Complexity:

From O(1) to O(log n) for most operations in optimized structures

[ 2.4 DS ]
↑ Top
ALG.006

Graph Algorithms

Algorithms that operate on graph data structures consisting of vertices connected by edges.

Key Algorithms:

  • Breadth-First Search
  • Depth-First Search
  • Dijkstra's Algorithm
  • Minimum Spanning Tree

Time Complexity:

From O(V+E) to O(V²) depending on graph representation and algorithm

[ 2.5 GRAPH ]
↑ Top