Algorithm


An algorithm is a sequence of rigorous steps which can be followed to solve a particular type of problem. To fully describe an algorithm, you must specify:

  1. The algorithm's name
  2. The input to the problem
  3. The output to the problem
  4. The steps taken to reach the output from the input

Algorithms are often written in programming languages, which have strict rules on syntax to ensure that a computer can compile it. To avoid syntax and focus only on the actual meaning of the code, an in-between language is used: pseudocode. Here's an example of an algorithm (the Euclidean algorithm) written in pseudocode:

algorithm euclid is
input: two integers, a and b, where a ≤ b
output: their greatest common divisor (gcd)

r ← b mod a
while r ≠ 0
b ← a
a ← r
r ← b mod a
return a

More advanced algorithms perform work beyond the scope of a simple calculation, using programming constructs such as conditionals to divert code, loops for iteration, and recursion to divide problems into easier sub-problems.

The output of an algorithm is specified by a return command.

Logic & Proofs
IntegerRational numberInequalityReal numberTheoremProofStatementProof by exhaustionUniversal generalizationCounterexampleExistence proofExistential instantiationAxiomLogicTruthPropositionCompound propositionLogical operationLogical equivalenceTautologyContradictionLogic lawPredicateDomainQuantifierArgumentRule of inferenceLogical proofDirect proofProof by contrapositiveIrrational numberProof by contradictionProof by casesSummationDisjunctive normal form
Set Theory
SetElementEmpty setUniversal setSubsetPower setCartesian productStringBinary stringEmpty stringSet operationSet identitySet proof
Functions
FunctionFloor functionCeiling functionInverse function
Algorithms
AlgorithmPseudocodeCommandAsymptotic notationTime complexityAtomic operationBrute-force algorithm
Relations
RelationReflexive relationSymmetric relationTransitive relationRelation compositionEquivalence relationEquivalence class
Number Theory
Integer divisionLinear combinationDivision algorithmModular arithmeticPrime factorizationGreatest common divisorLeast common multiplePrimality testFactoring algorithmEuclid's theoremPrime number theoremEuclidean algorithm
Induction
Proof by inductionFibonacci sequenceProof by strong inductionWell-ordering principleSequenceFactorialRecursive definition
Combinatorics
Rule of productRule of sumBijection rulePermutationCombinationComplement ruleExperimentOutcomeSample spaceEventProbabilityProbability distributionUniform distributionMultisetSixfold wayInclusion-exclusion principlePigeonhole principle
Graph Theory
GraphWalkSubgraphRegular graphComplete graphEmpty graphCycle graphHypercube graphBipartite graphComponentEulerian circuitEulerian trailHamiltonian cycleHamiltonian pathTreeHuffman treeSubstringForestPath graphStarSpanning treeWeighted graphMinimum spanning treeGreedy algorithmPrim's algorithm
Recursion
RecursionRecursive algorithmCorrectness proofDivide-and-conquer algorithmSorting algorithmMerge sort