Algorithm analysis uses proofs (to show an algorithm is correct or a bound holds) and probability (to find average-case running times). This page explains the words used in proofs and the one probability idea you need most: the expected value.
The vocabulary of proofs
Term
Meaning
Example
Statement / proposition
A sentence that is either true or false (not both).
“5 > 8” (false); “3 is prime” (true)
Conjecture
A proposition believed true but not yet proved.
Goldbach’s conjecture
Theorem
A proposition that has been proved true, usually an important one.
∑i=1ni2=6n(n+1)(2n+1) for all n≥1
Lemma
A smaller proved result used as a step in proving a theorem.
“Each pass of bubble sort moves the largest remaining item to the end.”
Corollary
A result that follows from a theorem with little extra proof.
From “every polynomial of degree m with am>0 is Θ(nm)”: "7n2+2n+3=Θ(n2)"
“What is 5 + 3?” or “Sort this list!” are not propositions: a question or a command is neither true nor false.
Mathematical expectation
It is a weighted average: each value counts in proportion to how likely it is.
Python · expectation.py
from fractions import Fraction# Example: mid-point of each marks range and the share of students in it.marks = [10, 30, 50, 70, 90]share = [8, 20, 57, 9, 6] # percent of students, adds up to 100expected = sum(Fraction(p, 100) * v for p, v in zip(share, marks))print("expected marks =", expected, "%")# A fair six-sided die: each face has probability 1/6.die = sum(Fraction(1, 6) * v for v in range(1, 7))print("expected die value =", die, "=", float(die))
Output
expected marks = 47 %expected die value = 7/2 = 3.5
Expectation in algorithm analysis
The average-case running time is an expected value: the values are the numbers of steps on different inputs, and the probabilities come from an assumption about which inputs are likely. In Unit 1, linear search on n elements makes i comparisons with probability 1/n for each i, so
Cavg(n)=∑i=1nn1⋅i=n1⋅2n(n+1)=2n+1.
The sum formula from the first section turns the expectation into a closed form.
Key takeaways
A proposition is true or false; a theorem is a proved proposition; a lemma helps prove a theorem; a corollary follows easily from one.
Expected value: E=∑pivi with probabilities adding to 1.
Expected value is a weighted average, not a plain average.
Average-case analysis computes the expected number of steps.
Practice questions
Answer on paper first, then check. The explanation matters more than the letter you chose.
Question 6 · short answer
A search finds its key after 1, 2 or 3 comparisons with probabilities 0.5, 0.3 and 0.2. Find the expected number of comparisons.
Show worked answer
E = 1(0.5) + 2(0.3) + 3(0.2) = 0.5 + 0.6 + 0.6 = 1.7 comparisons. (The probabilities 0.5 + 0.3 + 0.2 add up to 1, so the formula applies.)
MCA Online notes are made for reading on screen. Open https://mcastudy.online/mcs-211/some-pre-requisites-and-asymptotic-bounds/proof-vocabulary-and-mathematical-expectation/ to read this page.