Computers and Technology

In this exercise, you will write some code that reads n unique (no duplicates!) non-negative integers, each one less than fifty (50). Your code will print them in sorted order without using any nested loops-- potentially very efficient! We'll walk you through this: First, assume you are given an int variable n, that contains the number of integers to read from standard input. Also assume you are given an array, named wasReadIn, of fifty (50) bool elements and initialize all the elements to false. Third, read in the n integers from the input, and each time you read an integer, use it as an index into the bool array, and assign that element to be true-- thus "marking" in the array which numbers have been read. Lastly the "punchline": write a loop that traverses the bool array: every time it finds an element that is true it prints out the element's INDEX -- which was one of the integers read in. Place all the numbers on a single line, separated by a single spaces. Note: this technique is not limited to 50 elements-- it works just as well for larger values. Thus, for example you could have an array of 1,000,000 elements (that's right-- one million!) and use it to sort numbers up to 1,000,000 in value!

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 00:20, mmmmaaarriiieeee
The open systems interconnection (osi) reference model: defines standards for many aspects of computing and communications within a network. is a generic description for how computers use multiple layers of protocol rules to communicate across a network. defines standards for wireless local area network (wlan) communication protocols. details the advantages and disadvantages of various basic network cabling options.
Answers: 1
image
Computers and Technology, 23.06.2019 01:00, Ltik11900
Write the command that can be used to answer the following questions. (hint: try each out on the system to check your results.) a. find all files on the system that have the word test" as part of their filename. b. search the path variable for the pathname to the awk command. c. find all files in the /usr directory and subdirectories that are larger than 50 kilobytes in size. d. find all files in the /usr directory and subdirectories that are less than 70 kilobytes in size. e. find all files in the / directory and subdirectories that are symbolic links. f. find all files in the /var directory and subdirectories that were accessed less than 60 minutes ago. g. find all files in the /var directory and subdirectories that were accessed less than six days ago. h. find all files in the /home directory and subdirectories that are empty. i. find all files in the /etc directory and subdirectories that are owned by the group bin."
Answers: 1
image
Computers and Technology, 23.06.2019 04:10, cvbnkifdfg
2pointswho was mikhail gorbachev? oa. a russian leader who opposed a coupob. a polish leader who founded the labor union "solidarityoc. a soviet leader who called for a closer relationship with the unitedstates, economic reform, and a more open societyd. a soviet leader who called for more oppression in the soviet union
Answers: 3
image
Computers and Technology, 23.06.2019 08:30, mai1261
Helen's credit card has an apr of 15.32% and a grace period of 17 days and helen pays her balance in the full every month. if her last billing cycle ended on september 26, 2009, and she made her payment on october 11, 2009, did she owe any interest on her last statement's balance?
Answers: 3
Do you know the correct answer?
In this exercise, you will write some code that reads n unique (no duplicates!) non-negative integer...

Questions in other subjects: