Warning: foreach() argument must be of type array|object, bool given in /var/www/html/web/app/themes/studypress-core-theme/template-parts/header/mobile-offcanvas.php on line 20

A concept related, but not identical, to an algorithm is the idea of a heuristic. Read about heuristics and identify differences between the two. Describe a heuristic for obtaining an approximate answer to the sum of two threedigit numbers and show how this "addition heuristic" differs from the addition algorithm of Figure 1.2.

Short Answer

Expert verified
Heuristics are quick, approximate methods, while algorithms are precise, step-by-step procedures. The heuristic for adding 438 and 276 is rounding (400 + 300 = 700), whereas the algorithm gives the exact sum (714).

Step by step solution

01

Understand Heuristics and Algorithms

A heuristic is a problem-solving approach that uses practical and non-optimal methods to produce solutions quickly when an optimal solution is too costly or difficult to find. An algorithm, on the other hand, provides a specific, fixed method for solving a problem with a guaranteed solution.
02

Identify Key Differences

The main differences between a heuristic and an algorithm are that algorithms are rule-based, detailed step-by-step procedures that guarantee a correct solution if followed, whereas heuristics are flexible, approximate strategies that may not always provide a correct solution but are often faster and simpler to apply.
03

Describe the Addition Heuristic

To approximate the sum of two three-digit numbers using a heuristic, round each number to the nearest hundred and then add them together. For example, to add 438 and 276, first round 438 to 400 and 276 to 300. The approximate sum is 400 + 300 = 700.
04

The Addition Algorithm from Figure 1.2

The addition algorithm, as seen in Figure 1.2, involves aligning numbers by place value, adding each column starting from the right (units), carrying over any extra value to the next column if necessary, and obtaining an exact result. For 438 + 276, the exact sum is calculated as: units column 8 + 6 = 14 (write 4, carry over 1), tens column 3 + 7 + 1 = 11 (write 1, carry over 1), hundreds column 4 + 2 + 1 = 7, resulting in the sum of 714.
05

Compare the Heuristic and Algorithm

The heuristic gives an approximate result by simplifying the values and is quick (yielding 700 for the example), while the algorithm provides the exact result (714) by following a detailed procedure. The trade-off with heuristics is that they sacrifice accuracy for speed and simplicity.

Unlock Step-by-Step Solutions & Ace Your Exams!

  • Full Textbook Solutions

    Get detailed explanations and key concepts

  • Unlimited Al creation

    Al flashcards, explanations, exams and more...

  • Ads-free access

    To over 500 millions flashcards

  • Money-back guarantee

    We refund you if you fail your exam.

Over 30 million students worldwide already upgrade their learning with Vaia!

Key Concepts

These are the key concepts you need to understand to accurately answer the question.

Algorithms
Algorithms are a foundational concept in computer science and mathematics. They are systematic, rule-based instructions formulated to solve problems and produce an exact, reliable outcome. Each algorithm follows a step-by-step procedure, ensuring that if you start with the same inputs, you will always end up with the same outputs. This predictable characteristic of algorithms makes them highly dependable and essential for tasks requiring precision.

When considering an algorithm, imagine it as a recipe. Just as you wouldn’t skip steps when baking a cake to ensure it turns out right, algorithms demand that each step is followed exactly. This is what guarantees the accuracy of its results. However, this thoroughness also means algorithms can be time-consuming and may require significant computational resources, especially on complex tasks.
Problem-solving
Problem-solving is a broad concept that encompasses the methods we use to address and overcome challenges. While algorithms offer a precise way to solve specific problems, problem-solving isn't limited to this method alone. It's more about identifying various approaches and selecting the one that best suits the problem at hand.

When approaching problems, several strategies might be employed, such as:
  • Breaking down the problem into smaller, manageable parts.
  • Looking for patterns that can simplify the process.
  • Using heuristics to arrive at quick, approximate solutions.
Each of these methods serves a purpose depending on factors like the complexity of the problem or the time available to solve it. Ultimately, problem-solving is about being flexible and choosing the right tool for the job – be it an algorithm or a heuristic method.
Approximation
Approximation is a technique used when an exact answer is either unnecessary or would take too long to compute. It is particularly useful in scenarios where perfect precision is not required for the task at hand. By focusing on getting "close enough," approximation allows for quicker and often simpler solutions.

In our exercise, the approximation strategy involves rounding numbers before performing arithmetic operations, like the example given with adding 438 and 276. By rounding to the nearest hundred to obtain 400 and 300, the process gives an approximate sum of 700. This approach saves time and effort while providing a result that is reasonably close to the exact answer of 714.
Addition methods
There are various methods for performing addition, each with its advantages and disadvantages. Aside from traditional algorithms, heuristics provide an alternative technique to handle addition when immediacy is more critical than precision.

The addition algorithm is accurate, involving a structured approach to ensure each digit's place value is addressed correctly. As demonstrated in the exercise, the algorithm requires aligning numbers and processing each column from right to left, carrying values where necessary to achieve the precise answer.

On the other hand, the heuristic method simplifies the procedure by rounding numbers and adding those rounded figures for a quick estimate. While this addition heuristic may not always yield the exact result, it is valuable when assessments need to be made swiftly or when precision is a lesser priority. The decision between these addition methods boils down to the desired balance between accuracy and speed.

One App. One Place for Learning.

All the tools & learning materials you need for study success - in one app.

Get started for free

Most popular questions from this chapter

A standard computer DVD holds approximately 5 billion characters. Estimate how many linear feet of shelf space would be required to house 5 billion characters encoded as printed bound books rather than as electronic media. Assume there are 5 characters per word, 300 words per page, and 300 pages per inch of shelf.

The following is Euclid's 2,300-year-old algorithm for finding the greatest common divisor of two positive integers \(/\) and \(J\). Step Operation 1 Get two positive integers as input; call the larger value / and the smaller value J 2 Divide \(I\) by \(J\), and call the remainder \(R\) 3 If \(R\) is not 0 , then reset \(/\) to the value of \(J\), reset \(J\) to the value of \(R\), and go back to Step 2 4 Print out the answer, which is the value of \(J\) 5 Stop a. Go through this algorithm using the input values 20 and 32 . After each step of the algorithm is completed, give the values of \(I\), \(J\), and \(R\). Determine the final output of the algorithm. b. Does the algorithm work correctly when the two inputs are 0 and 32 ? Describe exactly what happens, and modify the algorithm so that it gives an appropriate error message.

A rapidly growing area of computer science is ubiquitous computing, in which computers automatically provide services for a user without that user's knowledge or awareness. For example, a computer located in your car contacts the garage door opener and tells it to open the garage door when the car is close to home. Read about this new model of computing and write a paper describing some of its applications. What are some of the possible problems that could result?

Identify which type of algorithmic operation each one of the following steps belongs to: a. Get a value for \(x\) from the user. b. Test to determine if \(x\) is positive. If not, tell the user that he or she has made a mistake. c. Take the cube root of \(x\). d. Do Steps 1.1, 1.2, and 1.3 x times.

A salesperson wants to visit 25 cities while minimizing the total number of miles she must drive. Because she has studied computer science, she decides to design an algorithm to determine the optimal order in which to visit the cities to (1) keep her driving distance to a minimum, and (2) visit each city exactly once. The algorithm that she has devised is the following: The computer first lists all possible ways to visit the 25 cities and then, for each one, determines the total mileage associated with that particular ordering. (Assume that the computer has access to data that gives the distances between all cities.) After determining the total mileage for each possible trip, the computer searches for the ordering with the minimum mileage and prints out the list of cities on that optimal route, that is, the order in which the salesperson should visit her destinations. If a computer could analyze \(10,000,000\) separate paths per second, how long would it take to determine the optimal route for visiting these 25 cities? On the basis of your answer, do you think this is a feasible algorithm? If it is not, can you think of a way to obtain a reasonable solution to this problem?

See all solutions

Recommended explanations on Computer Science Textbooks

View all explanations

What do you think about this solution?

We value your feedback to improve our textbook solutions.

Study anywhere. Anytime. Across all devices.

Sign-up for free