Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ Questions When a programmer resizes a vector of objects, which constructor i

ID: 3860216 • Letter: C

Question

C++ Questions

When a programmer resizes a vector of objects, which constructor is called for each new element? What attributes help choose among quick sort, merge sort, and heap sort? After all, all three algorithms are rated at n log_2 n on average... How is a vector of characters different from a string? A) strings provide searching functions and vectors don't B) strings generally treat their member characters as a single group/entity whereas a vector treats its data characters as individual values it just happens to hold together C) strings allow erase(), assign(), insert(), etc. via simple size_types, but vectors do not D) strings can be easily input and output for use in our user interface (UI) but vectors (even of characters) cannot be input or output in any easy or default way - we must process them element-by-element for such tasks E) strings can be easily initialized from literal strings but the most we can do for a vector at declaration time is to give it a certain number of empty elements (but that just makes managing it more difficult later...)

Explanation / Answer

20) vector::resize

21) space: heap sorted need less space than quick and merge. Heap sort is good when memory is tight and you have to sort small data that stored in a array.

more space: merge sort is good for data that is too big too be in memory at once, as pattern of storage acess is regular. merge sort do less comparison than heap sort. and is more suitable when fdata stored in linked list.

22)string can easily initialized from literal string but the most we can d o for a vector at declaration time is to give it a certain number of empty elements

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote