
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A series of exercises that require tracing code segments and showing the output. The exercises involve the use of various STL containers such as list, deque, and priority_queue. The document explicitly states that no external help should be used and scratchwork should be shown on paper. The exercises are designed to test the student's understanding of the STL containers and their methods.
Typology: Exercises
1 / 1
This page cannot be seen from the preview
Don't miss anything!

Trace the following code segments and show the output. // list
for (int j = 0; j <= 5; j++) numbers.insert(numbers.begin(), j);
list
deque
for (int i = 0; i < deqTest.size(); i++) cout << deqTest[i] << ' ';
cout << endl;
// priority_queue
pq.empty(); pq.push(1); pq.push(9); pq.push(2);
while (!pq.empty()) { cout << pq.top() << " "; pq.pop(); }
priority_queue
while (!pq1.empty()) { cout << pq1.top() << " "; pq1.pop(); }