C++ for Engineers and Scientists
4th Edition
ISBN: 9781133187844
Author: Bronson, Gary J.
Publisher: Course Technology Ptr
expand_more
expand_more
format_list_bulleted
Question
Chapter 7.6, Problem 7E
Program Plan Intro
Program Plan:
- NUMELS, n,i, userNumber,location, itIntVec,and partnums variables are used in the program.
- size (),begin(), end (), sort (), binary_search (), andfind () functions are used in the program.
Program Description: The main purpose of the program is to modify the C++ program 7.14 to use the binary_search () andfind ()
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
(Exhaustive Search: The Assignment Problem)
Complete the application of exhaustive search to The following assignment:
[9 2 7 8]
64 37
5818
769 4
C =
1, 2, 3, 4
1, 2, 4, 3
1, 3, 2, 4
1, 3, 4, 2
1, 4, 2, 3
1, 4, 3, 2
Complete the remaining cases:
Answer:
cost = 9+4+1+4 = 18
cost = 9+4+8+9 = 30
cost = 9+3+8+4 = 24
cost = 9+3+8+6 = 26
cost = 9+7+8+9 = 33
cost = 9+7+1+6 = 23
(C Language) The Fibonacci sequence begins with 0 and then 1 follows. All subsequent values are the sum of the previous two, for example: 0, 1, 1, 2, 3, 5, 8, 13. Complete the Fibonacci() function, which takes in an index, n, and returns the nth value in the sequence. Any negative index values should return -1.
(c++ and insertion sort)
To effectively measure the growth as the size of the data increases, generate four datasets with increasing amounts of elements n = 100, 200, 300...., until 3000 with 100 as increments. Transform the datasets so that one is already sorted (best case), one is half sorted (average case #1), one is randomized (average case #2), and one is in descending order (worst case). For each elementary operation of your sorting algorithm, place a frequency counter. The most important algorithms processes are the basic operations. In most sorting algorithms, this should simply be a counter for counting the number of comparisons and swaps. Each count should be done separately. Count the number of times each elementary operation is used in the best, average, and worst cases.
Chapter 7 Solutions
C++ for Engineers and Scientists
Ch. 7.1 - (Practice) Write array declarations for the...Ch. 7.1 - (Practice) Write correct notation for the first,...Ch. 7.1 - Prob. 3ECh. 7.1 - (Practice) a. Write output statements using cout...Ch. 7.1 - (Desk check) List the elements displayed by the...Ch. 7.1 - (Practice) a. Write a program to input the...Ch. 7.1 - (Practice) Write a program to input eight integer...Ch. 7.1 - (Data processing) a. Write a program to input 10...Ch. 7.1 - Prob. 9ECh. 7.1 - (Electrical eng.) Write a program that specifies...
Ch. 7.2 - (Practice) Write array declarations, including...Ch. 7.2 - (Data processing) Write an array declaration...Ch. 7.2 - (Data processing) Write a program that uses an...Ch. 7.2 - (Electrical eng.) Write a program that stores the...Ch. 7.2 - (Practice) a. Write a declaration to store the...Ch. 7.3 - (Practice) Write specification statements for the...Ch. 7.3 - (Desk check) Determine the output produced by the...Ch. 7.3 - (Practice) a. Write a C++ program that adds the...Ch. 7.3 - (Practice) Write a C++ program that adds...Ch. 7.3 - Prob. 5ECh. 7.3 - (Electrical eng.) a. An engineer has constructed a...Ch. 7.4 - Prob. 1ECh. 7.4 - Prob. 2ECh. 7.4 - Prob. 3ECh. 7.4 - Prob. 4ECh. 7.4 - Prob. 5ECh. 7.4 - (Electrical eng.) Write a program that declares...Ch. 7.4 - (Statistics) Write a program that includes two...Ch. 7.5 - Prob. 1ECh. 7.5 - (Practice) Run Program 7.10 to determine the...Ch. 7.5 - Prob. 3ECh. 7.5 - (List maintenance) a. Write a complete C++ program...Ch. 7.5 - Prob. 5ECh. 7.5 - (List maintenance) The following letters are...Ch. 7.5 - (File creation) Write a C++ program that creates...Ch. 7.5 - Prob. 8ECh. 7.5 - Prob. 9ECh. 7.5 - Prob. 10ECh. 7.5 - Prob. 11ECh. 7.5 - Prob. 12ECh. 7.5 - Prob. 13ECh. 7.5 - Prob. 14ECh. 7.5 - Prob. 15ECh. 7.6 - Prob. 1ECh. 7.6 - Prob. 2ECh. 7.6 - Prob. 3ECh. 7.6 - Prob. 4ECh. 7.6 - Prob. 5ECh. 7.6 - Prob. 6ECh. 7.6 - Prob. 7ECh. 7.6 - Prob. 8ECh. 7.6 - (Practice) Use the max_element and min_element...Ch. 7 - (Statistics) a. Write a C++ program that reads a...Ch. 7 - (Practice) Define an array named peopleTypes that...Ch. 7 - (Numerical) Given a one-dimensional array of...Ch. 7 - (Numerical) Write and test a function that returns...Ch. 7 - (Sorting) Read a set of numerical grades from the...Ch. 7 - (Numerical) a. Define an array with a maximum of...Ch. 7 - (Numerical) Using the srand() and rand() C++...Ch. 7 - (Statistical) In many statistical analysis...Ch. 7 - (Data processing) Your professor has asked you to...Ch. 7 - (Modify) Modify the program written for Exercise 9...Ch. 7 - Prob. 11PPCh. 7 - (Data processing) The answers to a true-false test...Ch. 7 - Prob. 13PPCh. 7 - (Data processing) Construct a three-dimensional...Ch. 7 - (Computation) A magic square is a square of...Ch. 7 - (Computation) Among other applications, Pascal’s...
Knowledge Booster
Similar questions
- (python question)arrow_forward(Pointers + Dynamic 1D Arrays) c++ program please use only pointers and dynamic 1D array and please don't use recursion and vector or otherarrow_forward(python) 20. Is the statement true or false? To add an element to the end of a list, use the insert function.arrow_forward
- (python) 16. Is the statement true or false? A list can contain another list as an element.arrow_forward(Pointers + Dynamic 1D Arrays) c++ program please use only pointers and dynamic 1D array and please don't use recursion and vector or otherarrow_forward(Q2) This is a Data Structures problem and the programming language used is Lisp. Solve the question we detailed steps and make it concise and easy to understand. Please and thank you.arrow_forward
- (JAVA) AVOID USING BREAKS, CATCH, AND CASE!!!! Texting Translator For this assignment, we are going to work with adding and removing data from arrays, linear search, and File I/O. This program will act as a texting to English converter This program will read a file containing a list of abbreviations used in texting and another file with their English translations. The abbreviations and translations need to be stored in two separate but parallel arrays (Links to an external site.). Open up two new text files inside of Eclipse: Name these text files abbreviations.txt and translations.txt Copy and paste the following list of names into your abbreviations.txt file: 4cuikrkl8l8rlmkm8nvmrsmhuurwu Copy and paste the following list of translations into your translations.txt file: forsee youI know right?okaylatelaterlet me knowmatenever mindareshaking my headyouyou arewhat's up? Starter Code /** * @author * @author * CIS 36B */ import java.util.Scanner; import java.io.File; import…arrow_forward(C++) PLEASE INCLUDE COMMENTS AND OUTPUT SCREEN Write a program that will do the following: In main, declare an array of size 20 and name it "randomArray." Use the function in step 2 to fill the array. Use the function in step 3 to print the array. Create a function that generates 20 random integers with a range of 1 to 10 and places them into an array. Re-cycle the functions from Lab 10 where appropriate. Make this a function. There will be two arguments in the parameter list of this function: an array and the size of the array. Within the function and the function prototype name the array: intArray. Within the function and the function prototype name the size of the array: size. The data type of the function will be void since the array will be sent back through the parameter list. Bring in the function that generates and returns a random number that you created from the previous module. Call that function from this within the loop that adds random numbers to the…arrow_forward(Q8) This is a Data Structures problem and the programming language used is Lisp. Solve the question we detailed steps and make it concise and easy to understand. Please and thank you.arrow_forward
- (Cartesian Map) In OCaml Programming Language: Use the built-in higher order functions and write a non-recursive function val cart_fun : (’a -> ’b -> ’c) -> ’a list -> ’b list -> ’c list = <fun> which takes a function, and two lists as an input, and returns a third list which contains the result of the function applied on all possible pairs of elements from both input lists. # cart_fun ( * ) [1;2;2;6;3;9;1] [2;3];; - : int list = [2; 3; 4; 6; 4; 6; 12; 18; 6; 9; 18; 27; 2; 3]arrow_forwardProblem 3. (Encryption Program) Write a program called encrypt.py that accepts the public-key n (int) and e (int) as command-line arguments and a message to encrypt from standard input, encrypts each character in the message, and writes its fixed-width binary representation to standard output. 'A tuple is like a list, but is immutable. You create a tuple by enclosing comma-separated values within matched parentheses, eg, a = (1, 2, 3). If a is a tuple, a[i] is the ith element in it. 5 / 7 Project 4 (RSA Cryptosystem) >- "/workspace/project4 $ python3 encrypt.py 3599 1759 Cs110 000110000000010011010100001010100011001010100011001110000110010111100100 Directions: • Accept public-key n (int) and e (int) as command-line arguments. • Get the number of bits per character (call it width) needed for encryption, ie, number of bits needed to encode n. • Accept message to encrypt from standard input. • For each character c in message: - Use the built-in function ord() to turn c into an integer x.…arrow_forward(IN PYTHON) Problem 1 Write a function word_count() that performs the following actions: Opens a file called “novel.txt”. You can assume that the file exists and is located in the same directory as your code file. Reads in the contents of the file, and stores it in a variable called text. Uses the split() function to obtain a list containing all of the individual words in text. For details on how to use split(), you can consult this site: https://www.w3schools.com/python/ref_string_split.asp For this question, assume that all words will be separated by spaces. Returns the number of words in the lisarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education