Run the program and observe the output to be: 55 4 250 19. Modify the numsInsert function to insert each item in sorted order. The new program should output: 4 19 55 250.
#include
#include
using namespace std;
void numsInsert(vector& numsList, int newNum) {
unsigned int i;
for (i = 0; i < numsList.size(); ++i) {
if (newNum < numsList.at(i)) {
// FIXME: insert newNum at element i
break; // Exits the for loop
}
}
// FIXME: change so executes if higher number NOT found
// Change "true" to "i == ??" (determine what ?? should be)
if (true) { // No higher number was found, so append to end
numsList.push_back(newNum);
}
}
void numsPrint(const vector& numsList) {
unsigned int i;
for (i = 0; i < numsList.size(); ++i) {
cout << " " << numsList.at(i) << endl;
}
}

int main() {
vector numsList;
numsInsert(numsList, 55);
numsInsert(numsList, 4);
numsInsert(numsList, 250);
numsInsert(numsList, 19);
numsPrint (numsList);

return 0;
}

Answers

Answer 1

Answer:

#include <iostream>

#include <vector>

using namespace std;

void numsInsert(vector<int>& numsList, int newNum) {

   unsigned int i;

   for (i = 0; i < numsList.size(); ++i) {

       if (newNum < numsList.at(i)) {

           // FIXME: insert newNum at element i

           numsList.insert(numsList.begin() + i, newNum);

           break; // Exits the for loop

       }

   }

   // FIXME: change so executes if higher number NOT found

   // Change "true" to "i == ??" (determine what ?? should be)

   if (i == numsList.size()) { // No higher number was found, so append to end

       numsList.push_back(newNum);

   }

}

void numsPrint(const vector<int>& numsList) {

   unsigned int i;

   for (i = 0; i < numsList.size(); ++i) {

       cout << " " << numsList.at(i) << endl;

   }

}

int main() {

   vector<int> numsList;

   numsInsert(numsList, 55);

   numsInsert(numsList, 4);

   numsInsert(numsList, 250);

   numsInsert(numsList, 19);

   numsPrint(numsList);

   return 0;

}

Explanation:


Related Questions

Most shop accidents are caused by?

Answers

Answer:Most shop accidents are caused by÷

liftingpoor light trips and fallsstressdangerous materialsact of shop violencedehydrationextreme tiredness

True or False, In adversarial searching, agents using the MiniMax algorithm always select the state that has the highest guaranteed net value.

Answers

Answer:

True

Explanation:

The MiniMax algorithm computes the MiniMax decision from the current state. The MiniMax algorithm always is especially known for its usefulness in calculating the best move in two-player games where all the information is available

What is the TSA motto

Answers

Answer:

the answer is "Learning to lead in a technical word".

Explanation:

45. _____ is used to create an object. a. Class b. constructor c. User-defined functions d. In-built functions

Answers

Answer: B

Explanation:       A constructor is a special method of a class or structure in object-oriented programming that initializes a newly created object of that type. ... Instead of performing a task by executing code, the constructor initializes the object, and it cannot be static, final, abstract, and synchronized.

In computer programming, a resource which is used to create an object is called: B. constructor.

What is a constructor?

A constructor can be defined as a special method that is designed and developed to enable programmers create and initialize objects in Java programming.

This ultimately implies that, a constructor is a resource which can used to create an object in computer programming.

Read more on constructor here: https://brainly.com/question/26914047

George has to present the goals of information management to his team member. What is a goal of information management? The goal of information management is to identify information requirements for various levels.

Answers

Answer:

The purpose of information management is to: design, develop, manage, and use information with insight and innovation. support decision making and create value for individuals, organizations, communities, and societies.

Explanation:

Egovernment involves the use of strategies and technologies to transform government by improving the delivery of services and enhancing the quality of interaction between the citizen-consumer within all branches of government.

a. True
b. False

Answers

I guess the answer True

When it comes to different ways of storing data on the device in a cross-platform manner, what is convenient about both native iOS and Android platforms?

a. they both provide secure file i/o
b. they both provide key-value, file i/o and sqlite data storage
c. the both provide the exact same system calls, since both platforms rely on ARM processors
d. they both provide the exact same APIs, regardless of language used

Answers

A - both provide secure file i/o

in media literacy,
how does media influence public? and the press

⚫ analyze or compare the influences of social media
⚫ analyze the ethics or journalist, news outlets, etc​

Answers

what is mean by computers

______________________ created a comprehensive standard to help any organization create an information security governance program.

a. The Federal Trade Commission
b. The Government Accountability Office (GOA)
c. The International Organization for Standardization (ISO) and the International Electrotechnical Commission (IEC)
d. National Institute of Standards and Technology (NIST)

Answers

c the internation Organization for standardization (iso) and the international electrotechnical commission (irc)

The Federal Trade Commission created a comprehensive standard to help any organization create an information security governance program. Thus, option A is correct.

What is International Electrotechnical Commission (IEC) ?

International Electrotechnical Commission (IEC) which was first formed in 1906 is the predominant organization for developing and publishing international standards for technologies related to electrical and electronic devices and processes.

The standards developed by this association are widely used in scientific fields such as power generation, semiconductors, fibre optics, batteries, solar energy, nanotechnology and marine energy. They also proposed the International System of Units( SI unit) used in many fields of study today.

Therefore, The Federal Trade Commission created a comprehensive standard to help any organization create an information security governance program. Thus, option A is correct.

Learn more about Federal Trade Commission on:

https://brainly.com/question/12007903

#SPJ2

When it comes to memory, why is it important to have enough storage space on a hard drive when using many RAM intensive programs?

Answers

Answer:

Memory and storage are important concepts to master in Information Technology. ... This type of memory is volatile which means that the actual data disappears when the computer loses power. Because memory needs to be much faster than storage, it is rather more expensive than storage per GB.

Explanation:

Define mini computer

Answers

Answer:

Definition of minicomputer

a small computer that is intermediate between a microcomputer and a mainframe in size, speed, and capacity, that can support time-sharing, and that is often dedicated to a single application.

Answer:

A very small Computer

Explanation:

I computer that is very small like a apple watch.


8. Which of the following is
most likely to contain a
computer virus?


1.CD-ROM
2.RAM
3.Floppy Disk
4.ROM

Answers

Answer:

4. A floppy Disk

Explanation:

This is because it can be transfered from one device to another. So, if one device is infected with a virus, it'll be affected

[tex].[/tex]

software.
Q4..
Microsoft word is an example of
(A) System
(1) word processor
(°) Presentation software
(P) Spreadsheet

Answers

Ms Word is an example of a word processor.

One example of a Word Processor is Microsoft Word, but other word processing applications are also widely used.

what are the functions of an input device​

Answers

to provide data and control signals to an information processing system such as a computer or other information appliance.

Answer:

This article does not cite any sources.

In computing, an input device is a piece of equipment used to provide data and control signals to an information processing system such as a computer or information appliance. Examples of input devices include keyboards, mouse, scanners, cameras, joysticks, and microphones.

What method is known as a class's constructor, because it is run automatically when a user instantiates the class

Answers

      A constructor is a special method of a class or structure in object-oriented programming that initializes a newly created object of that type. ... Instead of performing a task by executing code, the constructor initializes the object, and it cannot be static, final, abstract, and synchronized.

Select the best answer for the question
17. Which of the following is a design theory that recognizes that many problems are similar to problems that have already been solved?
O A. C-K Theory
O BASE
OC. TRIZ
OD. General Design Theory

Answers

your answer is C my guy

What software programming language was first
used to power the Internet (.com, .net)?

Answers

Answer:

the answer should be .com, because the very first domain was Symbolics.com

Explanation:

hope this helps, have a great day.

Why LinkedIn doesn’t like automation tools?

Answers

Answer:

LinkedIn has clearly mentioned that using LinkedIn automation is against their TOS. They block an account if they suspect any automation activity.

It’s because they want to keep the platform transparent and free of spam. Many users have already called it the worsts social media platform because of spamming.

On the other hand, large companies and brands are endorsing these tools. Many users have got their accounts blocked while many are using LinkedIn automation to grow their business opportunities.

List at least three particular pieces of data you would collect to determine the effects of water pollution kind of data would you collect (number data, text data , sensor , etc.)? Would you be able to make any other conclusions by using the data you collect?

Answers

The three particular pieces of data which a person would collect to determine the effects of water pollution are

TemperatureTurbiditypH level

The question of whether a person would be able to make any other conclusions by using the data you collect is:

Yes, because the data can be analysed.

What is Water Pollution?

This refers to the contamination of water which makes a body of water to begin to lose its natural composition.

With this in mind, we can see that to find out the effects of water pollution in a particular body of water, then there needs to be extensive testing of the water to find out the pH level, water temperature, etc.

Read more about water pollution here:
https://brainly.com/question/1235358

A browser processes requests every time a person clicks on a
hyperlink.
O True
O False

Answers

Answer:

False

Explanation:

Topic:

Recursion. Use recursion to display the pattern given above. No loops allowed.

See the picture for the pattern​

Answers

Answer:

const SIZE=8

function print(n, s) {

 if (n > 0) {

   process.stdout.write(s);

   print(n-1, s);

 }

}

function main(n=1) {

 if (n<=SIZE) {

   print(SIZE-n, "  ");

   print(n, "* ");

   process.stdout.write("\n");

   main(n+1);

 }

}

main();

Explanation:

Here is a solution in javascript. Note that it uses recursion multiple times to avoid loops.

50 ) What is the cell address of 4th row and 4th column? A) 4D B) E4 оооо C) 04 D) B4​

Answers

Answer:

The cell address of 4th row and 4th column is

4D/D4

Write a algorithm to calculate the sum of digits in a given three digit number

Answers

[tex]{\huge{\pink{↬}}} \:  \: {\huge{\underline{\boxed{\bf{\pink{Answer}}}}}}[/tex]

Sum of digits algorithm

Step 1: Get number by user.

Step 2: Get the modulus/remainder of the number.

Step 3: sum the remainder of the number.

Step 4: Divide the number by 10.

Step 5: Repeat the step 2 while number is greater than 0.

give 5 examples for software ​

Answers

Answer:

Adobe Photoshop.

Picasa.

VLC Media Player.

Windows Media Player.

Windows Movie Maker

_ is an environment where processors are embedded in objects that communicate with one another via the Internet or wireless networks.

Answers

The right answer will be "The Internet of Things (IoT)".

Connecting computers systems, electromechanical machinery as well as digital ones with distinctive identifications as well as the possibility of transference of information through the internet without interactivity as well as people.Such an IoT system would be a collection of web-enabling connected devices which employ embedded subsystems, particularly CPUs, captors, and networking gear, to gather as well as transmit information from their surroundings and execute upon that.

Learn more about IoT here:

https://brainly.com/question/19995128

what do these two parts of the lift do?​

Answers

Answer:

The Big Bang Theory is our best guess about how the universe began. A 2013 map of the background radiation left over from the Big Bang, taken by the ESA's Planck spacecraft, captured the oldest light in the universe. This information helps astronomers determine the age of the universe. ... The "Big Bang Theory" TV show.

Software engineer is responsible for defining the level of maturity the software program must perfom at in order to declare software test

a. True
b. False

Answers

Answer:

true

Explanation:

Hope, it helps to you

How was Television used when originally invented? How is television used today?

Answers

Explanation:

.......................

Answer:

Than:

Baird's early mechanical television had 30 holes and rotated 12.5 times per second. There was a lens in front of the disk to focus light onto the subject. When light hit the subject, that light would be reflected into a photoelectric cell, which then converted this light energy to electrical impulses.

Now :

Television is an inescapable part of modern culture. We depend on TV for entertainment, news, education, culture, weather, sports—and even music, since the advent of music videos. ... News, current events and historical programming can help make young people more aware of other cultures and people.

Comparison
Cloud computing and parallel processors

Answers

Anwser is 2/3

Explanation:

Write a short note on
i) Printer
i)Speaker
( no problem if u don't know but don't just spam :(.....)​

Answers

A printer is a device that accepts text and graphic output from a computer and transfers the information to paper, usually to standard-size, 8.5" by 11" sheets of paper. Printers vary in size, speed, sophistication and cost.

Other Questions
2.How are we affected by texts in various ways?3.In what ways is meaning constructed, negotiated, expressed and interpreted? How do you create a mission statement? Can anyone plzz tell me the reasons for this false ones Plzz help . One of my close friends _______ us a question that neither of us _______ able to answer. * write an expression that means the same as the sentence. "the sum of sixteen and g is equal to seventy divided by seven. " 14 - 2(x + 8) = 5x - (3x - 34); Prove: x = -9 Examine the tile pattern at right Form a linear equation for the given statement and draw its graph:Taxi fare for the first km is charged at Rs 20 and Rs 10 is charged for another extra1 km. What is the best description of the word 'recessive' as it is used in biology?A. Having two identical versions of an allele in a cell.B. An allele that is always expressed, even if there is only one copy in a cell.C. An allele that induces reclusive behavior in an organism.D. An allele that is only expressed if two versions of it are present in a cell.boil In a titration, when the number of moles of hydrogen ions equals the number of moles of hydroxide ions, what is said to have happened?The equivalence point has been reached.The point of neutralization has been reached.The end point has been reached. What are the homeostatic pressures an axolotl goes through and how dothey deal with that? Para ti cual es tu idea personal del paraso y del infierno? Find the inverse of f(x) = -4+7/2x C Complete these sentences with for or since. Then compare with a partner. 1. Maura was in Central America____a month last year. 2. I've been a college student _____ almost four years. 3. Hiroshi has been at work___almost four 6:00 A.M. 4. I haven't gone to a party____a long time. 5. Sean lived in Bolivia___two years as a kid. 6. My parents have been on vacation____ Monday. 7. Jennifer was engaged to Theo___six months. 8. Alex and Brianna have been best friends____high school. D PAIR WORK Ask and answer these questions. How long have you had your current hairstyle? How long have you studied at this school? How long have you known your best friend?How long have you been awake today? who had discovered cell and in which year a shopkeeper sold 16 articles for a total of 400 and made a profit of 48.00 how much did each article cost him Please help due today I need help on this question. Based on Ponyboys description of his parents, what similarities do you see between the brother and the mother and the father? What differences do you see? Explain the importance of profession