Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

232 Chapter 5 Algorithms Chapter Review Problems (Anterinked problem ate associated with optional sectcimin.) 1. Give an example of a set of steps that con-

image text in transcribed
232 Chapter 5 Algorithms Chapter Review Problems (Anterinked problem ate associated with optional sectcimin.) 1. Give an example of a set of steps that con- (print the value assigned to count and forms to the informal definition of an algo Count -- Count + 1) rithm given in the opening paragraph of 8. Rewrite the following program segment using Section 5.1 but does not conform to the formal a while structure rather than a repeat struc definition given in Figure 5.1. ture. Be sure the new version prints the same 2. Explain the distinction between an ambiguity values as the original in a proposed algorithm and an ambiguity in Count + 1; the representation of an algorithm repeat 3. Describe how the use of primitives helps (print the value assigned to count and remove ambiguities in an algorithm's Count Count + 1) representation until (Count = 5) 4. Select a subject with which you are familiar 9. What must be done to translate a posttest loop and design a pecudocode for giving directions expressed in the form in that subject. In particular, describe the primitives you would use and the syntax you repeat (...) until would use to represent them. (If you are into an equivalent posttest loop expressed in having trouble thinking of a subject, try the form sports, arts, or crafts.) do ...) while. 5. Does the following program represent an algo 10. Design an algorithm that, when given an rithm in the strict sense? Why or why not? arrangement of the digits 0, 1, 2, 3, 4, 5, 6, 7, Count = 0; 8, 9, rearranges the digits so that the new while (Count not 5) do arrangement represents the next larger (Count Count + 2) value that can be represented by these digits 6. In what sense do the following three steps not (or reports that no such rearrangement constitute an algorithm exists if no rearrangement produces a larger Step 1: Draw a straight line segment between value). Thus 5547382901 would produce 5647382910 the points with rectangular coordinates (2,5) and (6,11). 11. Design an algorithm for finding all the factors Step 2: Draw a straight line segment between of a positive integer. For example, in the case the points with rectangular coordinates (13) of the integer 12, your algorithm should and (3,6) report the values 1, 2, 3, 4, 6, and 12. Step 3. Draw a circle whose center is at the 12. Design an algorithm for determining the day intersection of the previous line segments and of the week of any date since January 1, 1700. whose radius is two For example, August 17, 2001 was a Friday, 7. Rewrite the following program segment using 13. What is the difference between a formal pro- a repeat structure rather than a while struc gramming language and a pseudocode? ture. Be sure the new version prints the same 14. What is the difference between syntax and values as the original semantics? Count = 2; 15. The following is an addition problem in tradi- while (Count

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Relational Database And Transact SQL

Authors: Lucy Scott

1st Edition

1974679985, 978-1974679980

More Books

Students also viewed these Databases questions

Question

Presentations Approaches to Conveying Information

Answered: 1 week ago

Question

=+ d. a professor deciding how much to prepare for class

Answered: 1 week ago