Problem

Continuing Programming Project 4, write a function that separates the students in the vect...

Continuing Programming Project 4, write a function that separates the students in the vector of Studentlnfo records into two vectors, one containing records of passing students and one containing records of failing students. (Use a grade of 60 or better for passing.)

You are asked to do this in two ways, and to give some run-time estimates.

a. Consider continuing to use a vector. You could generate a second vector of passing students and a third vector of failing students. This keeps duplicate records for at least some of the time, so don’t do it that way. You could create a vector of failing students and a test-for-failing function. Then you push_bacl< failing student records, then erase (which is a member function) the failing student records from the original vector. Write the program this way.

b.Consider the efficiency of this solution. You are potentially erasing 0{N) members from die middle of a vector. You have to move a lot of members in this case, erase from the middle of a vector is an 0(NJ operation. Give a big-O estimate of the running time for this program.

c.If you used a 1ist, what are the run-times for the erase and insert functions? Consider how die time efficiency of erase for a list affects die run-time for the program. Rewrite this program using a list instead of a vector. Remember that a list provides nethier indexing nor random access and its iterators are only bidirectional, not random access

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 18
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT