Introduction to Algorithms
- 93Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
- spaceFlip card
- KI knew it
- DI didn't know it
- ←Previous card
- →Next card
What is the modern meaning of an algorithm?
A procedure or set of rules for carrying out a task or solving a problem.
Or swipe the card
93 cards
What is the modern meaning of an algorithm?
A procedure or set of rules for carrying out a task or solving a problem.
How is the word “algorithm” historically connected to al-Khwarizmi?
Al-Khwarizmi’s name was Latinized as “Algoritmi,” which later gave rise to the word “algorithm.”
What did al-Khwarizmi contribute to calculation and algebra?
He recorded methods for calculation and introduced methods for working with algebra.
Why is the historical phrase “Arabic numbering” potentially misleading?
The numbering system al-Khwarizmi recorded originated in India; he presented it under the Arabic label.
What is an effective method?
A finite set of exact instructions that always stops with the correct answer for problems in its intended class.
What assumption does the classical definition of an effective method make about who can carry it out?
In principle, any person can carry it out using only writing materials and by following the instructions exactly.
How are algorithms related to proofs and algebraic procedures?
Formal procedures for solving problems are closely connected to algorithms: both specify steps for deriving a result from rules or inputs.
What does it mean for an algorithm to be unambiguous?
Its instructions are sufficiently clear to be followed without uncertainty about what each step requires.
How does determinism differ from unambiguity?
A deterministic algorithm gives the same answer when run repeatedly on the same input; unambiguity means its instructions are clear.
Can an algorithm be nondeterministic and still have a consistent structure?
Yes. Its route or outcome may vary with conditions or inputs while following the same essential structure.
Who or what did “computer” often refer to before electronic computers became common?
A person who performed calculations, often as part of a team of skilled human mathematicians.
Why are standard algorithms useful?
They let people reuse established solutions instead of inventing a new procedure for every problem.
What is the basic procedure used by bubble sort?
Compare adjacent items and swap them when they are in the wrong order; repeat passes until the list is sorted.
Why is bubble sort a poor choice for sorting a very large list?
Its worst-case running time grows quadratically, approximately as N2 for N items.
What is the best-case running time described for bubble sort when it can stop after a pass with no swaps?
Approximately N steps, when the input is already sorted.
What kind of input gives bubble sort its worst case?
A list in reverse order.
What does time complexity measure?
How the number of computational steps grows as the input size increases.
What does space complexity measure?
How the amount of storage required by an algorithm grows with input size.
Why can an algorithm’s running time depend on the input data, not just its size?
Different arrangements of the same number of items can require different numbers of steps.
What does Big-O notation describe in algorithm analysis?
The rate at which an algorithm’s resource use scales as input size grows.
What is the central strategy of merge sort?
Split the data into smaller lists, sort those lists, and merge the sorted sublists.
What is Timsort, and where is it used?
A sorting algorithm used in several programming languages and platforms, including Python and Android software.
How do the growth rates N, �logN, NlogN, and N2 compare in general as input size grows?
Linear and logarithmic growth are generally more favorable than NlogN, which is generally more favorable than quadratic growth.
Why does complexity analysis avoid “computer top trumps” comparisons?
It compares how resource use scales with input size rather than comparing raw speeds on particular computers.
What is the traveling salesperson problem (TSP)?
Find the shortest circuit that visits each specified location exactly once and returns to the starting point.
How can a route-planning problem such as TSP be represented mathematically?
As a graph whose locations are vertices and whose travel distances are associated with connections between them.
What is a brute-force search for a TSP route?
Enumerate possible visit orders, calculate each complete route’s length, and select the shortest.
Why does brute-force TSP become impractical as the number of locations grows?
The number of possible routes grows factorially with the number of locations.
How many visit orders does a basic brute-force search consider for a circular TSP with a fixed start and n locations?
(n−1)! orders; if a route and its reverse are treated as equivalent, the number of distinct circuits is (n−1)!/2.
What does the TSP example with 13 locations illustrate about brute-force search?
It can be manageable for a small instance, but scaling the same method to many more locations can make the search infeasible.
Why does making a computer faster by a large factor not necessarily solve a factorial-growth problem?
Factorial growth can overwhelm even enormous speed improvements as the input grows.
What is meant by an intractable problem in the context of the lecture?
A problem for which known exact methods can require impractically large amounts of computation as the input grows.
What is the nearest-neighbor heuristic for TSP?
Starting at a location, repeatedly travel to the closest location not yet visited, then complete the tour.
Why can nearest-neighbor TSP produce different routes on the same set of locations?
Its result can depend on which location is chosen as the starting point.
What did the 13-location example show about nearest-neighbor route lengths?
Different starting locations produced routes of about 4.7 to 5.3 km, compared with an optimal route of about 4.4 km.
What does it mean for a feasible TSP route to give an upper bound on the optimum?
The optimal route cannot be longer than that feasible route, because the optimum is the shortest valid route.
What does a lower bound on an optimization problem tell you?
It tells you a value that the optimum cannot be smaller than.
What is the Held–Karp algorithm used for in TSP?
It is an exact algorithm that finds an optimal TSP route, with exponential-time complexity described as proportional to n22n.
What guarantee does the Christofides algorithm provide for metric TSP?
It produces a route no longer than 3L∗/2, where L∗ is the optimal route length.
What is the difference between an exact TSP algorithm and an approximate TSP algorithm?
An exact algorithm guarantees the optimum; an approximate algorithm may not, but can run more practically and may provide a bound on solution quality.
Why are approximation guarantees useful when an optimum cannot be computed practically?
They provide a known bound on how far a computed solution can be from the optimum.
What is the main trade-off between brute force and nearest neighbor for TSP?
Brute force can find the optimum but scales poorly; nearest neighbor is fast and simple but may give a suboptimal route.
What is notable about the later improvement to the Christofides approximation factor described in the lecture?
It improved the factor by only 10−36 below 3/2, an extremely small numerical gain.
Why can an algorithmic improvement matter even if its numerical gain is tiny?
It may introduce a new approach that enables further improvements later.
What does the Cobham–Edmonds thesis use as a practical rule of thumb?
Problems solvable in polynomial time are treated as computationally tractable, while problems outside that class raise concern about scalability.
What does polynomial-time complexity mean?
The number of steps is bounded by a polynomial in the input size, such as n, n2, or n3.
What important practical limitations does the polynomial-time rule of thumb ignore?
It ignores hardware, constant factors, and the actual input size.
Why is it incorrect to assume every problem outside polynomial time is useless in practice?
Many practical tasks do not have known polynomial-time solutions, yet people still need to solve or approximate them.
What is iteration in an algorithm?
Repeating a set of steps, often until a condition is met.
What is recursion in its modern technical sense?
A structure in which an algorithm calls itself, typically with different parameters.
How can factorial be defined recursively?
For positive n, n!=n(n−1)!, with a base case such as 0!=1.
What is a flowchart?
A diagram that represents the steps and control flow of a process or algorithm using standardized symbols.
What is pseudocode?
An informal, code-like description of an algorithm written as a sequence of instructions.
What is one advantage of flowcharts over pseudocode?
Flowcharts use a defined set of symbols and can communicate procedures across programming languages.
What is one practical reason flowcharts fell out of fashion?
They were cumbersome to create on early computers, where graphical tools were difficult to use.
What was the Entscheidungsproblem?
The question of whether there is a general method to decide, for a given formula, whether it can be derived from a specified set of axioms.
What was the answer to the general Entscheidungsproblem described in the lecture?
No general procedure can decide every such case.
What is a Turing machine?
A formal model of computation that reads and writes symbols on a tape according to a finite set of rules.
What is a universal Turing machine?
A Turing machine that can simulate other Turing machines by using their descriptions as input.
What does the Church–Turing thesis claim?
Any algorithmic computation can be represented by a Turing machine, and Turing-machine computation captures the general notion of an algorithm.
Why are Turing machines useful even though they are not practical computers?
They provide a simple theoretical model for reasoning about what computation can do.
What is a decision problem?
A problem whose answer is yes or no.
How can the equation z=x+y be turned into a decision problem?
Ask, “Does z equal x+y?” and answer yes or no.
How can TSP be expressed as a decision problem?
Ask whether there is a circuit visiting all required locations whose length is less than a specified bound.
What is the class P?
The set of decision problems solvable by a deterministic Turing machine in polynomial time.
What is the class NP?
The set of decision problems for which a proposed solution can be verified in polynomial time.
Why is every problem in P also in NP?
If a problem can be solved in polynomial time, its answer can also be verified in polynomial time.
Why can checking a completed Sudoku grid be easier than solving an unfinished one?
A completed grid can be checked against the rules directly, while finding a valid completion may require searching many possibilities.
What conditions must a completed standard Sudoku grid satisfy?
Each row, each column, and each 3×3 subgrid must contain the digits 1 through 9 without repeats.
What is the central P-versus-NP question?
Does every problem whose solution can be verified in polynomial time also have a solution that can be found in polynomial time?
What is the prevailing expectation about whether P=NP?
Most theorists suspect that P=NP, but the question remains unresolved.
What are NP-complete problems?
Problems in NP to which every problem in NP can be reduced using an appropriate efficient transformation.
What does it mean to reduce one problem to another?
Transform instances of one problem into instances of another so that solving the second can be used to solve the first.
What is the significance of the result that “PRIMES is in P”?
It showed that deciding whether a number is prime can be done in polynomial time.
What is the difference between NP-hard and NP-complete?
NP-hard problems are at least as hard as every problem in NP; NP-complete problems are NP-hard problems that also belong to NP.
What is the halting problem?
Given a program and its input, determine whether the program will eventually stop.
Is there a general algorithm that solves the halting problem for every program and input?
No. The halting problem is undecidable: no algorithm can correctly decide it in every case.
How does BPP differ from P?
BPP is the class of problems solvable in polynomial time using probabilistic computation; whether it equals P is unresolved.
What is BQP?
The quantum-computing analogue of BPP: problems solvable in polynomial time by a quantum computer, under the class’s error conditions.
What is PSPACE?
The class of problems solvable using an amount of memory bounded by a polynomial in the input size, regardless of how much time is required.
What is co-NP, informally?
A class characterized by the ability to efficiently verify that proposed answers are wrong, or to exclude incorrect answers.
What is a complexity class?
A collection of computational problems grouped by shared requirements for resources such as time, space, or verification.
Are all computational problems solvable given enough time and memory?
No. Some problems are unsolvable by any computer, regardless of available time or space.
Why is the complexity-class landscape described as a “zoo”?
There are many distinct classes, relationships among them are often unknown, and some form hierarchies of increasing difficulty.
How could P=NP affect public-key cryptography?
It could undermine some systems whose security depends on a problem being hard to solve but easy to verify.
What computational asymmetry is useful in public-key cryptography?
A legitimate user can efficiently verify or use a solution, while an eavesdropper faces a much harder problem to solve.
Can an algorithm itself be racist, or does bias enter through its design and data?
An algorithm can produce discriminatory decisions, but bias can arise from its design choices or training data rather than from the algorithm as an abstract procedure.
How could a fraud-detection system become discriminatory through proxy variables?
If it uses a credit score correlated with where someone lives, and residence is correlated with ethnicity, it may indirectly discriminate by ethnicity.
What is one approach to reducing algorithmic bias mentioned in the lecture?
Develop methods for producing less biased algorithms and training data, and evaluate their impacts.
Why can an updated or learning system depart from its original specification?
Updates or newly learned data can change the system’s behavior after it was first specified.
What is the challenge of verifying a complex program?
It can be difficult to establish confidence that the program always produces the outputs it is supposed to produce.
Why did an exam-grading algorithm create a fairness problem even if it had been carefully tested?
Its effects disadvantaged a substantial number of students, and the wider consequences for fairness and trust were not adequately anticipated.
What lesson does the exam-grading example give about algorithmic decision-making?
A technically developed algorithm is not enough; decision-makers must anticipate its human consequences and assess fairness.

Ask anything
We've read this whole study set, so questions about it get the best answers.