Question
PLEASE ANSWER ALL QUESTIONS ASAP. NO NEED TO EXPLAIN. JUST LETTER ANSWER CHOICE IS PERFECT! 1) For a binary search tree, the best possible order
PLEASE ANSWER ALL QUESTIONS ASAP. NO NEED TO EXPLAIN. JUST LETTER ANSWER CHOICE IS PERFECT!
1) For a binary search tree, the best possible order in which elements are added to the tree would include:
a. middle value first
b. smallest value first
c. largest value first
d. order does not matter
2) For a heap, the best possible order in which elements are added to the heap would include: (assume the largest value is stored at the root)
a. middle value first
b. smallest value first
c. largest value first
d. order does not matter
3) If the following expressions were both legal, which other expressions should be legal?
stack
auto iter = names.begin();
a. | ++iter, *names | |
b. | *iter, names.end() | |
c. | *iter, names++ | |
d. | iter.begin(), names.end() |
4) There is a "push_back()" function for vectors, but no "push_front()" function. Why do you think that is?
a. | It is not an efficient operation for vectors and with push_back(), there is no need for a push_front() | |
b. | Because of push_back(), there is no need for push_front() | |
c. | It was not put in the original version of the API. Adding it in now would break existing code. | |
d. | It is not an efficient operation for vectors |
5)
Suppose you were to implement an iterator for a linked list class? Suppose you did this by storing an index in the iterator to indicate which element the iterator refers to, so you'd store 0 for the first element, 1 for the second element and so on. What would be the big O time complexity for dereferencing this iterator?
a. | O(n) | |
b. | O(1) | |
c. | O(n2) | |
d. | O(log n) |
6)Your company makes a personal health app and wants to test it with different kinds of people to see that it works out for them. The company has decided to classify people along the following dimensions: age, diet, exercise habits. There are A groups when divided by age, D groups when divided by diet, and E groups when divided by exercise habits. What is the big O in terms of the minimum number of people you need to cover all possibilities?
a. | O(A+D+E) | |
b. | O(A*D*E) | |
c. | O(1) | |
d. | O(2A*D*E) |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started