algorithm: a finite sequence of precise instructions for performing a computation or solving a problem
searching algorithm: the problem of locating an element in a list
linear search algorithm: a procedure for searching a list element by element
binary search algorithm: a procedure for searching an ordered list by successively splitting the list in half
sorting: the reordering of the elements of a list into prescribed order
bubble sort: a sorting algorithm that puts a list into increasing order by successively comparing adjacent elements and interchanging them if they are in the wrong order
insertion sort: a sorting algorithm that at the jth step inserts the jth element into the correct position in the list, when the first j−1 elements of the list are already sorted
greedy algorithm: an algorithm that makes the best choice at each step according to some specified condition
halting problem: the problem of determining whether a computer program will eventually stop when run with a given input
solvable problem: a problem that can be solved by an algorithm
unsolvable problem: a problem that cannot be solved by an algorithm
time complexity: the amount of time required for an algorithm to solve a problem (measured in terms of operations)
space complexity: the amount of space in computer memory required for an algorithm to solve a problem
worst-case time complexity: the greatest amount of time required for an algorithm to solve a problem of a given size
average-case time complexity: the average amount of time required for an algorithm to solve a problem of a given size
best-case time complexity: the minimum amount of time required for an algorithm to solve a problem of a given size
algorithmic paradigm: a general approach for constructing algorithms based on a particular concept
brute force: the algorithmic paradigm based on constructing algorithms for solving problems in a naive manner from the statement of the problem and definitions
tractable problem: a problem for which there is a worst-case polynomial-time algorithm that solves it
intractable problem: a problem for which no worst-case polynomial-time algorithm exists for solving it
class P: the class of problems that can be solved in polynomial worst-case time
class NP: the class of problems for which a solution can be checked in polynomial time
NP-complete problem: a problem in NP with the property that if any of these problems can be solved by a polynomial worst-case time algorithm, then all problems in the class NP can be solved by polynomial worst-case time algorithms
Key Results
The central results, algorithm complexities, and reference rules established in Chapter 3:
Algorithm Complexities (Sections 3.1 & 3.3):
Linear search: Uses Θ(n) comparisons in the worst case (and on average).
Binary search: Uses Θ(logn) comparisons in the worst case.
Bubble sort: Uses 2n(n−1) comparisons; worst-case time complexity is Θ(n2).
Insertion sort: Uses 2n(n+1)−1 comparisons in the worst case; worst-case time complexity is Θ(n2).
Optimal comparison sorting: Sorting n elements can be performed in O(nlogn) time.
Matrix multiplication: Standard algorithm for two n×n matrices uses n3 multiplications and n2(n−1) additions, giving O(n3) operations.
Boolean product of zero–one matrices: Computing A⊙B for two n×n matrices uses 2n3 bit operations.
Properties of Big-O, Big-Ω, and Big-Θ (Section 3.2):
Factorial growth: logn! is O(nlogn).
Sum Rule: If f1(x) is O(g1(x)) and f2(x) is O(g2(x)), then (f1+f2)(x) is O(max(∣g1(x)∣,∣g2(x)∣)).
Product Rule: If f1(x) is O(g1(x)) and f2(x) is O(g2(x)), then (f1f2)(x) is O(g1(x)g2(x)).
Leading Term of Polynomials: If f(x)=anxn+an−1xn−1+⋯+a1x+a0 with an=0, then f(x) is of order xn, so f(x) is Θ(xn), O(xn), and Ω(xn).
Hierarchy of Growth:
1≺logn≺n≺nlogn≺n2≺2n≺n!
Common Complexity Terminology (Section 3.3):
Θ(1): Constant complexity
Θ(logn): Logarithmic complexity
Θ(n): Linear complexity
Θ(nlogn): Linearithmic complexity
Θ(nb): Polynomial complexity
Θ(bn) (b>1): Exponential complexity
Θ(n!): Factorial complexity
The Halting Problem and Unsolvability (Section 3.1):
There does not exist a computer program that can determine whether an arbitrary program P with input I eventually halts. The halting problem is unsolvable.