3. (Comparing Singly and Doubly Linked Lists) In this exercise we carry out some operations on std::list
Question:
3. (Comparing Singly and Doubly Linked Lists)
In this exercise we carry out some operations on std::list
Answer the following questions:
a) Create instances of A and B with n elements, where n is typically a large number (for example, at least a million).
b) Insert an element at every alternate position in the lists A and B.
c) Remove all even elements from the lists A and B.
d) Sort and reverse the lists A and B.
e) Create an instance of B with n elements all of whose values are the same value val.
Compare the run-time efficiency of using a single call to remove all the elements with value val and removing elements one by one.
Use the stopwatch class to measure the relative run-time performance in all cases.
Step by Step Answer: