Starting Out with C++: Early Objects (9th Edition)
Starting Out with C++: Early Objects (9th Edition)
9th Edition
ISBN: 9780134400242
Author: Tony Gaddis, Judy Walters, Godfrey Muganda
Publisher: PEARSON
Expert Solution & Answer
Book Icon
Chapter 9.6, Problem 9.12CP

Explanation of Solution

Basic operations:

The basic operation is the initial step in the algorithm and this is otherwise called as basic step.

  • Normally, the algorithm executes the basic step in constant time rather than considering about the size of the input.
  • So, it means that size of the bound does not affect the efficiency of the operations.
  • The complexity of an algorithm can be found out by finding the number of basic steps required for an input.

Comparing the efficiency of an algorithm:

In the given question, one algorithm requires “10n” basic operations to process an input

Blurred answer
Students have asked these similar questions
Two algorithms A, B sort the same problem. When you go through each algorithm and break them down into their primitive operations, each can be represented as below                              A =   n4 + 100n2 + 10n + 50                               B = 10n3 + 2n2  + nlogn + 200   For very large values of n which of these algorithms explain why B   will run in the shortest time to solve the problem
A computer science student designed two candidate algorithms for a problem while working on his part-time job The time complexity of these two algorithms are T,(n) = 3 n logn and T2(n) = n6/5 a) Which algorithm is better? Why? b) If we run both algorithms at the same time with an input size of 105, which algorithm produces results faster than the other one? Why?
Suppose you have algorithms with five running times. Assume these are the exact running times. How much slower do each of these algorithms get when you (a) double the input or (b) increase the input size by one? Do both.  This problem requires discrete math. I solved all of these but I had a quick question. My teacher wanted us to use the big 0 notation for these running times, but the problem is that I'm not sure if that's necessary for these problems for the question it's asking. I tried to the big 0 notations for the first three. For (a) I got 8n3. Which I'm not sure is right. For example, for 1b I got 3n2 + 3n + 1 for how much slower these get from the original. Is that correct? Was I supposed to do something more for the big 0 notation. You can check to see if these answers are correct.  The big O notation formula is f(n) = 0(g(n)).  (a) n2  For double size I got 4n2. I got 2n + 1 from the input the size by one. I think that's all I need to do. I got similar answers for theother…

Chapter 9 Solutions

Starting Out with C++: Early Objects (9th Edition)

Ch. 9.6 - Prob. 9.11CPCh. 9.6 - Prob. 9.12CPCh. 9.6 - Prob. 9.13CPCh. 9.6 - Prob. 9.14CPCh. 9.6 - Prob. 9.15CPCh. 9 - Prob. 1RQECh. 9 - Prob. 2RQECh. 9 - Prob. 3RQECh. 9 - Prob. 4RQECh. 9 - Prob. 5RQECh. 9 - Prob. 6RQECh. 9 - Prob. 7RQECh. 9 - A binary search will find the value it is looking...Ch. 9 - The maximum number of comparisons that a binary...Ch. 9 - Prob. 11RQECh. 9 - Prob. 12RQECh. 9 - Bubble sort places ______ number(s) in place on...Ch. 9 - Selection sort places ______ number(s) in place on...Ch. 9 - Prob. 15RQECh. 9 - Prob. 16RQECh. 9 - Why is selection sort more efficient than bubble...Ch. 9 - Prob. 18RQECh. 9 - Prob. 19RQECh. 9 - Prob. 20RQECh. 9 - Prob. 21RQECh. 9 - Charge Account Validation Write a program that...Ch. 9 - Lottery Winners A lottery ticket buyer purchases...Ch. 9 - Lottery Winners Modification Modify the program...Ch. 9 - Batting Averages Write a program that creates and...Ch. 9 - Hit the Slopes Write a program that can be used by...Ch. 9 - String Selection Sort Modify the selectionSort...Ch. 9 - Binary String Search Modify the binarySearch...Ch. 9 - Search Benchmarks Write a program that has at...Ch. 9 - Sorting Benchmarks Write a program that uses two...Ch. 9 - Sorting Orders Write a program that uses two...Ch. 9 - Ascending Circles Program 8-31 from Chapter 8...Ch. 9 - Modified Bin Manager Class Modify the BinManager...Ch. 9 - Using Files-Birthday List Write a program that...Ch. 9 - Prob. 14PCCh. 9 - Using Files-String Selection Sort Modification...Ch. 9 - Using Vectors String Selection Sort Modification...
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education