Question: f the last element that has been pushed onto a Q3: How can a program obtain the value Vector myvec? (a) With myvec.back ). (b)
f the last element that has been pushed onto a Q3: How can a program obtain the value Vector myvec? (a) With myvec.back ). (b) By returning myvec.end) tej with iny hcki and myvec [myvec.size _ and myvec [myvec . size ( ) ] . (d) with both myvec. back() theSize and Q4: A vector data structure is implemented so that the two data members int Capacity ill always remain properly synchronized. The implementations will make sure that (a) The value of thesize will never be equal to the value of myCapacity (b) The value of thesize will always be less or equal myCapacity. (c) The value of thesize will always be equal to myCapacity. to he valueof mycapacity will be increased when theSize has reached a value that is a constant amount larger than myCapacity. Q5: Pict (2) then erasing t scenario? ure the combined computational cost for (1) finding a target element in a vector and his element from the vector? What is true about the worst case of this (a) The worst-case cost is of order O(N2) where N is the size of the vector. (c) The worst-case cost is proportional to the number N of elements in the vector, thus (b) Finding and erasing vector elements are simple operations with O(1) cost c ombined. 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, which code fragment below could compute the size of a list? (a) itera tor i =begin(); while (i * ? = head->next; int k=0; while (i != 0) (k++; i i-next; return *i; Node
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
