Chapter 5: Q2E (page 370)
Trace Algorithm 1 when it is given n = 6 as input. That is, show all steps used by Algorithm 1 to find 6!, as is done in Example 1 to find 4!.
Short Answer
The value of 6 ! is 720 .
Chapter 5: Q2E (page 370)
Trace Algorithm 1 when it is given n = 6 as input. That is, show all steps used by Algorithm 1 to find 6!, as is done in Example 1 to find 4!.
The value of 6 ! is 720 .
All the tools & learning materials you need for study success - in one app.
Get started for freeProve that Algorithm 3 for computing gcd (a,b) when a and b are positive integers with a < b is correct.
Prove that the first player has a winning strategy for the game of Chomp, introduced in Example 12 in Section 1.8, if the initial board is two squares wide, that is, a board. [Hint: Use strong induction. The first move of the first player should be to Chomp the cookie in the bottom row at the far right.]
Prove that the algorithm you devised in Exercise 17 is correct.
Give a recursive algorithm for finding the maximum of a finite set of integers, making use of the fact that the maximum of n integers is the larger of the last integer in the list and the maximum of the first n - 1 integers in the list.
Give a recursive algorithm for finding a mode of a list of integers. (A mode is an element in the list that occurs at least as often as every other element.)
What do you think about this solution?
We value your feedback to improve our textbook solutions.