0% found this document useful (0 votes)
70 views2 pages

9.3 LimitsOfAlgorithms

This document discusses algorithms and their limits. It provides examples of algorithms for solving problems related to the traveling salesman problem, chess games, and transportation routing. Key points made are that calculating all possible moves in a chess game would take unreasonable time, and heuristics can provide good enough solutions when exact solutions require unreasonable time but are not necessary. Undecidable problems have no solution while unreasonable time algorithms have solutions that just take too long to compute.

Uploaded by

Nathanael Slager
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
70 views2 pages

9.3 LimitsOfAlgorithms

This document discusses algorithms and their limits. It provides examples of algorithms for solving problems related to the traveling salesman problem, chess games, and transportation routing. Key points made are that calculating all possible moves in a chess game would take unreasonable time, and heuristics can provide good enough solutions when exact solutions require unreasonable time but are not necessary. Undecidable problems have no solution while unreasonable time algorithms have solutions that just take too long to compute.

Uploaded by

Nathanael Slager
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Limits of Algorithms

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 the move made by white, black makes a move. This


creates multiple options for white to respond. The algorithm attempts
to calculate every possible move and choose the one that will have
the greatest chance of winning.

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

6. In which of the following situations is it most appropriate to use a heuristic solution?


a. The only algorithms that provide exact solutions run in linear time.
b. The problem has been identified as undecidable.
c. The only algorithms that provide exact solutions run in unreasonable time but exact
solutions are not necessary.
d. Two different algorithms have been identified that solve the problem in reasonable time.

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.

Save this document and submit it.

Computer Science Principles 2

You might also like