Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

ow can a program obtain the value of the last element that has been pushed onto a Vector myvec? (a) WIth myveback () (b) By

image text in transcribed

ow can a program obtain the value of the last element that has been pushed onto a Vector myvec? (a) WIth myveback () (b) By returning myvec.end ) (c) With myvec [myve.ni) (d) With both myvec. bak and my vec (myvec.nize1 Q4: A vector data structure is Implemented so that the two data members int thesize and int mycapacity will always remain properly synchronized. The implemations 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 equal to myCapacity (c) The value of thesize will always be less or equal mycapacity (d) None of the above Q5: Picture the combined computational cost for (1) finding a target element in a vector and (2) then erasing this element from the vector? What is true about the worst case of this scenario? (a) The worst-case cost is of order O(N2) where N is the size of the vector. (b) Flnding 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 comparable cheap cost of 0(1)? (a) Return the value of tail head1i (b) Iterates though the list nodes from head to tail and count (c) Keep track of the size of the list as values are entered (d) This ls not possible. ow can a program obtain the value of the last element that has been pushed onto a Vector myvec? (a) WIth myveback () (b) By returning myvec.end ) (c) With myvec [myve.ni) (d) With both myvec. bak and my vec (myvec.nize1 Q4: A vector data structure is Implemented so that the two data members int thesize and int mycapacity will always remain properly synchronized. The implemations 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 equal to myCapacity (c) The value of thesize will always be less or equal mycapacity (d) None of the above Q5: Picture the combined computational cost for (1) finding a target element in a vector and (2) then erasing this element from the vector? What is true about the worst case of this scenario? (a) The worst-case cost is of order O(N2) where N is the size of the vector. (b) Flnding 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 comparable cheap cost of 0(1)? (a) Return the value of tail head1i (b) Iterates though the list nodes from head to tail and count (c) Keep track of the size of the list as values are entered (d) This ls not possible

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts Of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

4th Edition

0619064625, 978-0619064624

Students also viewed these Databases questions