Introduction to Algorithms
- 45Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
- spaceFlip card
- KI knew it
- DI didn't know it
- ←Previous card
- →Next card
What is an algorithm?
An algorithm is a computational procedure—a step-by-step recipe for solving a problem.
Or swipe the card
45 cards
What is an algorithm?
An algorithm is a computational procedure—a step-by-step recipe for solving a problem.
What are the basic parts of an algorithm's input-output behavior?
An algorithm takes specified inputs, performs a computation, and produces an output.
What is the input-output specification for an algorithm that multiplies two numbers?
For multiplication, the inputs are two integers, such as n and m, and the output is their product, n×m.
What is an instance of a problem? Give the multiplication example.
An instance is a particular problem case formed by substituting specific values for the inputs; for example, n=121 and m=234 is an instance of multiplication.
What happens when an algorithm is run on a particular instance?
The algorithm carries out a mechanical, step-by-step procedure and returns the answer; executing it does not require creativity.
What are the main steps of the grade-school multiplication algorithm?
In grade-school multiplication, multiply by each digit in turn, shift each partial product according to that digit's place, then add the partial products with carries.
How does a problem specification differ from an instance of the problem?
The problem specification states what the inputs and desired output are; an instance supplies particular input values to that problem.
Were algorithms invented only after computers? Explain.
Algorithms existed long before modern computers; people in many cultures developed procedures to carry out needed calculations.
What kinds of problems did many early algorithms address?
Early algorithms were often numerical procedures, such as methods for multiplying numbers.
How could multiplication algorithms help people measure land?
Multiplying measured side lengths lets people calculate the area of a rectangular piece of land.
What kinds of events motivated historical calendrical calculations?
People used calculations to predict events such as eclipses, full moons, and tides.
What calculation tool is associated with early Chinese mathematical algorithms?
Chinese mathematicians used the abacus to carry out calculations.
What important numerical innovations are attributed to ancient Indian mathematicians?
Ancient Indian mathematicians developed the place-value number system and arithmetic algorithms that worked with it.
What problem does the Euclidean algorithm solve?
The Euclidean algorithm is used to calculate the greatest common divisor (GCD) of two numbers.
What is the sieve of Eratosthenes used for?
The sieve of Eratosthenes is a method for identifying prime numbers.
Where does the word “algorithm” come from?
The word ultimately derives from the name of the mathematician al-Khwarizmi, whose work on arithmetic and equations was translated into Latin and studied in the West.
How were algorithms often regarded by mathematicians before the advent of computers?
Before computing, algorithms were often treated as secondary to mathematical theorems, and some important procedures were not published.
Why did computers increase the demand for efficient algorithms?
Computers created demand for efficient procedures that could handle calculations too large or error-prone for people to perform manually, such as multiplying very long numbers or testing large numbers for primality.
What model of computation did Alan Turing introduce in the 1930s?
Alan Turing developed a model of computation in the 1930s called the Turing machine.
How does the Turing machine relate to the idea of a computational procedure?
The Turing machine provides a formal model for describing computation and helps define what counts as a computational procedure.
What does the Church–Turing thesis claim about physically realizable computers?
The Church–Turing thesis proposes that any computer physically realizable using the laws of physics has the same computational power as a Turing machine.
Which two mathematicians are associated with the Church–Turing thesis?
The thesis is associated with Alonzo Church and Alan Turing.
Why is the study of algorithms considered a computer science discipline?
Algorithms are abstract recipes for computation intended to be implemented on a computer; studying them became a distinct field in computer science.
Why do Internet search engines need efficient algorithms?
Search engines rely on rapid, efficient algorithms to identify webpages and other results relevant to a query.
How can a search engine use a user's location when answering a restaurant query?
A search engine can use the user's approximate GPS location to return nearby results, such as local Greek restaurants.
What information can a search engine's prebuilt location index connect?
A prebuilt index can map geographic locations to search terms, terms to relevant locations, and restaurant listings to their reviews.
What is the basic process for producing location-aware search results?
It uses the query and approximate location to find relevant listings, retrieves associated information such as reviews, and assembles a results page.
Why must search algorithms return results quickly?
The search must be completed quickly—typically in milliseconds to seconds—so the results do not feel slow to load.
What must a navigation service do to find a route from address A to address B?
A navigation service must locate both addresses on a physical map and solve a shortest-path problem between them.
Why might a navigation service compute alternative paths in addition to a shortest path?
Navigation services may provide alternative routes as well as the shortest path.
How can current traffic information help a navigation service estimate travel time?
By considering current traffic conditions on candidate paths, the service estimates how long the trip will take.
Why do airports need to schedule planes waiting to land, and how is this often handled?
Airports have limited runways and taxiways, so planes waiting to land must be scheduled; this task is often handled manually.
What type of problem is assigning planes to airport gates?
Assigning landed planes to gates is an assignment problem.
What type of problem is scheduling planes for runway takeoff?
Deciding the order in which planes use a runway to take off is a scheduling problem.
How do airlines generally allocate aircraft to routes?
Airlines generally schedule available aircraft across the routes they need to fly rather than reserving one particular aircraft for each route.
What can prompt an airline to substitute an aircraft, and what kind of problem is allocating vehicles to routes?
Delays or aircraft faults may require an airline to bring a different plane into service; allocating vehicles to routes is a vehicle-assignment problem.
How can algorithms help a delivery company move a package from one location to another?
A delivery company schedules packages onto suitable planes or other transportation to move them between locations.
How does a truck delivering packages illustrate the traveling salesperson problem?
The traveling salesperson problem (TSP) models finding a route that visits delivery addresses and returns the truck to its starting depot.
Why can improvements to TSP algorithms matter to delivery companies?
The TSP is very difficult to solve, but efficient solutions can reduce costs substantially for companies that plan delivery routes.
What are two additional airline logistics tasks that algorithms can support?
Airline logistics can include assigning aircraft to routes and choosing fuel-efficient routes that account for conditions such as wind.
What does the National Resident Matching Program assign?
The National Resident Matching Program assigns medical students to residency positions at hospitals.
What kind of algorithm is used in the lecture's example of matching medical students to residencies?
The residency matching program is described as using a stable marriage algorithm to match applicants and positions.
What allocation problem does residency matching help address?
The matching process helps connect residents seeking training positions with hospitals seeking trainees, filling positions and placing applicants.
Give a medical application of stable matching besides residency placement.
Stable matching algorithms are also used to match kidney donors with kidney patients.
How can algorithms benefit society beyond computing?
Algorithms support efficient allocation, scheduling, and assignment; these uses can reduce waste and help coordinate services in everyday life.

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