Starting Out with Programming Logic and Design (4th Edition)
4th Edition
ISBN: 9780133985078
Author: Tony Gaddis
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 11, Problem 4AW
Look for ways to modularize the
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Instructions for Questions 1 through 6. For each piece of pseudocode, give the
runtime in terms of N. Your answer should give an exact value for the number of times
the inner loop runs (i.e. the final value of count), and it should also give the order of
growth of the runtimes using big-Oh notation. You can assume that N "comes out nicely"
with respect to loops. For example, if the loop counts by 2, you can assume it is an even
number, and if it multiplies or divides by 2 each time, you can assume it is a power of 2.
Note: log(N!) is 0(NlogN).
Let’s say you have a 5-digit number, 23456. You are supposed to write a code that prints numbers in the ones, tens, hundreds, thousands, and ten thousands places of this number. In the text box below, write the steps you will follow to write the code. Share it on the discussion forum. Here, you only need to write the approach in a step-by-step manner, just like you did with algorithm design in the case of computational thinking.
Personal project Q5.
This question is concerned with the design and analysis of recursive algorithms.
You are given a problem statement as shown below. This problem is concerned with performing calculations on a sequence ? of real numbers. Whilst this could be done using a conventional loop-based approach, your answer must be developed using a recursive algorithm. No marks will be given if your answer uses loops.
FindAverageAndProduct(a1, ...., an) such that n > 1
Input: A sequence of real values A = (a1, ..., an) Output:, A 2-tuple (average, product) containing the average (average) of all the values and the product (product) of all the values of the elements in A.
Your recursive algorithm should use a single recursive structure to find the average and product values, and should not use two separate instances of a recursive design. You should not employ any global variables.
(a) Produce a pseudo code design for a recursive algorithm to solve this problem.
(b) Draw a call-stack…
Chapter 11 Solutions
Starting Out with Programming Logic and Design (4th Edition)
Ch. 11.1 - What is a menu-driven program?Ch. 11.1 - The items displayed in a menu are often preceded...Ch. 11.1 - What type of structure do you use in a program to...Ch. 11.3 - Explain why most menu-driven programs use a loop...Ch. 11.3 - If a program uses a loop to display a menu...Ch. 11.4 - Prob. 11.6CPCh. 11.4 - Prob. 11.7CPCh. 11.4 - When a program has a lot of items for the user to...Ch. 11 - Prob. 1MCCh. 11 - Prob. 2MC
Ch. 11 - If a menu-driven program uses a loop to redisplay...Ch. 11 - A program that uses a multiple-level menu displays...Ch. 11 - Prob. 5MCCh. 11 - When the user selects an operation from a...Ch. 11 - When the user selects an operation from a(n)...Ch. 11 - Prob. 1TFCh. 11 - It is not usually necessary to validate the user's...Ch. 11 - In most cases, a menu-driven program should be...Ch. 11 - If a menu-driven program does not use a loop to...Ch. 11 - In a single-level menu, the user might see a...Ch. 11 - What type of structure do you use in a program to...Ch. 11 - What ways for validating a users menu selection...Ch. 11 - How can you design a menu-driven program so that...Ch. 11 - When a program has a lot of items for the user to...Ch. 11 - Prob. 1AWCh. 11 - Design a case structure that can be used with the...Ch. 11 - Put the algorithms that you designed for questions...Ch. 11 - Look for ways to modularize the algorithm that you...Ch. 11 - Language Translator Design a program that displays...Ch. 11 - Prob. 2PECh. 11 - Prob. 3PECh. 11 - Astronomy Helper Create an application that...Ch. 11 - Golf Score Modification In Programming Exercise 6...Ch. 11 - Phone Book Program Design a program that you can...Ch. 11 - Prob. 7PE
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Write a loop equivalent to the for loop above without using .
C Programming Language
Describe the difference between the while loop and the do-while loop.
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Each repetition of a loop is known as a(n) a cycle ________. a. cycle b. revolution c. orbit d. iteration
Starting Out with Python (3rd Edition)
What are some features of specific programming languages you know whose rationales are a mystery to you?
Concepts Of Programming Languages
Practice Problem 7.2 (solution page 718) In this problem, let REF(x.i) DEF(x.k) denote that the linker will ass...
Computer Systems: A Programmer's Perspective (3rd Edition)
Either a functions ____ or its ____ must precede all calls to the function.
Starting Out with C++: Early Objects
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Personal project Q5. This question is concerned with the design and analysis of recursive algorithms. You are given a problem statement as shown below. This problem is concerned with performing calculations on a sequence A of real numbers. Whilst this could be done using a conventional loop-based approach, your answer must be developed using a recursive algorithm. No marks will be given if your answer uses loops. FindAverageAndProduct(a1, ...., an) such that n > 1 Input: A sequence of real values A = (a1, ...., an) Output:, A 2-tuple (average, product) containing the average (average) of all the values and the product (product) of all the values of the elements in A. Your recursive algorithm should use a single recursive structure to find the average and product values, and should not use two separate instances of a recursive design. You should not employ any global variables. (a) Produce a pseudo code design for a recursive algorithm to solve this problem. (b) Draw a call-stack…arrow_forwardTwo kinds of loops occur frequently in programming: counter-controlled loops and sentinel-controlled loops. Explain each kind of loop in terms of its implementation with your own examples. Q3.arrow_forwardLook at both the iterative and recursive methods of solving problems, and see how they stack up against one another. When should you use recursion and when should you use iteration? As an alternative to relying on the examples provided in the presentation slides, explain why your point of view is correct.arrow_forward
- Explain why an algorithm with a repetition control structure with a count-controlled loop is a better choice than a repetition with an event-controlled loop for the algorithm you created in question 6.arrow_forwardArrange them logically once you make a list of all the different mathematical procedures.arrow_forwardAfter listing all mathematical techniques, arrange them logically.arrow_forward
- Although the debugging technique has been carried out, the issue still has not been fixed. At this point, what options do you have?arrow_forwardHi, this picture is the homework I have and it was on this site so I paid to see the answers, but it only answered question a. Can you show me how to solve the rest of the tasks?arrow_forwardReview the two algorithms below. Explain the difference between the two algorithms in terms of the number of times the loop body may be executed. Convert_Feet_to_Yards1 Response = Yes2 While (response = Yes) do Steps 3 to 73 Get value for feet4 Set value of yards to (feet / 3)5 Print the value of yards6 Print the message ‘Do you want to convert another measure?’7 Get a new value for response from the user8 Stop Convert_Feet_to_Yards1 Do Steps 2 to 62 Get value for feet3 Set value of yards to (feet / 3)4 Print the value of yards5 Print the message ‘Do you want to convert another measure?’6 Get a new value for response from the user7 While (response = Yes)8 Stoparrow_forward
- Investigate both the iterative and the recursive methods of problem resolution, and then compare and contrast the results of your research. When would you use iteration when recursion would be more appropriate, and when would you use recursion when iteration would be more appropriate? Your answer should be justified by giving examples that are different from those that are shown on the slides of the presentation.arrow_forwardWhat are the next three actions you can take if debugging has been attempted and you are still experiencing issues?arrow_forwardList all of the different mathematical operations that you can think of, and then organise them in decreasing order of difficulty.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Graphical User Interfaces: Crash Course Computer Science #26; Author: CrashCourse;https://www.youtube.com/watch?v=XIGSJshYb90;License: Standard YouTube License, CC-BY
Python GUI | How To Make A GUI In Python | Best GUI Framework In Python | Edureka; Author: edureka!;https://www.youtube.com/watch?v=_PHJvjQJa3w;License: Standard Youtube License