Question: 3. How can a program obtain the value of the element that has been most recently P the element that has been most recently pushed

 3. How can a program obtain the value of the element

3. How can a program obtain the value of the element that has been most recently P the element that has been most recently pushed onto a Vector myvec? (a) With myvec.back() (b) With myvec.end() (c) With myvec[myvec.size() (d) With both myvec. back() and myvec[myvec.size() 04. A vector data structure is implemented so that the two data members int thesize and rent thesize and int my capacity will always remain properly synchronized. The implementations will make sure that . (a) The value of theSize be kept equal to my Capacity. (b) The value of theSize will always be less than myCapacity. (c) The value of theSize can be larger than my Capacity. (d) None of the above. Q5: Picture the combined computational cost for first finding a target element in a vector and then erasing this element from the vector? What is true about the computational cost for the worst case of this type of problem? (a) The worst-case cost is of order O(N') where N is the size of the vector. (b) Finding and erasing vector elements are simple operations with O(1) cost combined. (c) The worst-case cost is proportional to the number N of elements in the vector, thus O(N). (d) None of the above. Q6: If the List data structure did not maintain a data member mySize for the purpose of keeping track of the number of elements contained, how could the size of the list still be determined at a cheap cost of O(1)? (a) Return the value of tail - head + 1; (b) Iterate though the list nodes from head to tail and count. (c) Keep track of the largest value entered. (d) It will be impossible to determine the size at constant cost (1). 07: If you want to mimic random access of values in a linked list that is equivalent to the O(1) operator [k] for vectors, you can do this at cost (1) with a list iterator itr and 3-step code fragment itr mylist.begin(); itr = itr + k; *itr; (a) This statement is true. (b) This statement is false

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!