Question: If the queue sent to the function is 1, 5, 8, 10, 15, 22, 55, what is the final state of the queue? (NOTE: 1

If the queue sent to the function is 1, 5, 8, 10, 15, 22, 55, what is the final state of the queue? (NOTE: 1 is the front of the tail)

template void f(queue& q) { vector v; int n = q.size(), i; for(i=0;i < n/2; i++) { v.push_back( q.front() ); q.pop(); } for (i=0;i < v.size();i++) q.push( v[i] ); }

Please choose one:

a.

10, 15, 22, 55, 1, 5, 8

b.

10, 15, 22, 55, 15, 22, 8

c.

1, 5, 8, 10, 15, 22, 55

d.

1, 5, 22, 55, 15, 22, 8

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!