9.3 LimitsOfAlgorithms
9.3 LimitsOfAlgorithms
In this assignment, you'll apply what you learned in the lesson to determine if an algorithm runs in
unreasonable time and develop a heuristic to solve a problem. You'll also distinguish between decision
problems and optimization problems. Answer each question as you complete this worksheet.
1. In the lesson, you developed a heuristic to help you find a "good enough" solution to the
Traveling Salesman Problem. Click here to open that app in Code Studio. What is the shortest
path that you were able to find?
1196
Write down the heuristic that you developed to find that path.
Stay on the edges, choosing dots that are closest to eachother.
2. Using the same app, click the New Level button to get a new random arrangement of nodes.
Test your heuristic. Write down the distance for the path your heuristic finds.
1037
Test your heuristic on several other arrangements of nodes. Does your heuristic give a "good
enough" path most of the time? Do you need to update your heuristic? Write a paragraph
explaining your findings.
Essentially, after multiple trials I found that each of the runs ended at about 1000 so my
heuristic was quite consistent and relatively accurate at developing a good enough path.
3. A programmer is writing a game program to play chess. To decide on the most appropriate
move, the algorithm needs to determine all the possible combinations of moves given the
current arrangement of the pieces.
The game begins with the pieces arranged as shown here. There are
20 possible first moves for the white pieces – any of the pawns can
move one or two spaces forward or either of the knights can move in
an L-shape to the right or left.
Based on your understanding of algorithms, do you think the chess game algorithm will run in
reasonable or unreasonable time? Explain your reasoning.
I believe that this would take an unreasonable amount of time to run this chess algorithm because there
are too many possible combinations that the algorithm would have to compute for.
Computer Science Principles 1
(continued on next page)
4. Lupita wants to travel to Florida to visit family. She decides to use a computer search algorithm
to find ways that she might travel. She types the following into the search engine:
Are there flights from Boise to Miami?
This is an example of:
a. a decision problem
b. an optimization problem
c. an undecidable problem
5. Jonah's family has moved and he needs to find out which bus to ride to his new school. He
consults the bus route and schedule on the school's website and sees that several bus routes
pass close to his house. He compares the distances of the various bus stops near his house,
pickup times, and time he would spend on the bus for each of the available routes.
This is an example of:
a. a decision problem
b. an optimization problem
c. an undecidable problem
7. Problems that are undecidable and algorithms that are unreasonable both touch on the limits of
the kinds of computing that a computer can accomplish. In your own words, explain the
difference between undecidable problems and unreasonable time algorithms.
Undeciable problems have no actual solution whereas unreasonable time algorithms have a
solution but it takes too much time to solve.