Show Menu
Cheatography

Algorithms Cheat Sheet (DRAFT) by

Algorithm complexity

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Comple­xities

Name
Worst case
Average case
Best case
Fractional Knapsack
O(n*lo­g(n))
0-1 Knapsack
O(n*W)
MergeSort
O(n*lo­g(n))
Select­ion­-Sort
O(n^2)
Insert­ion­-sort
O(n^2)
Heap-sort
O(n*lo­g(n))
Quick-sort
O(n^2)
 
O(n*lo­g(n))
Compar­iso­nBased Sort
   
Ω(n*lo­g(n))
BucketSort
O(n + N)
RadixSort
O(d*(n + N))
QuickS­elect
O(n^2)
O(n)
O(n)
 

Divide­-an­d-C­onquer

Divide-and conquer is a
general algorithm design
paradigm:
-> Divide: divide the input data S in
two or more disjoint subsets S1,
S2, ...
-> Conquer: solve the subpro­blems
recurs­ively
-> Combine: combine the solutions
for S1, S2, ..., into a solution for S

Greedy Method

Dynamic Progra­mming

 

Master Theorem

Master Theorem