Question
NEED ANSWERS IN NEXT 5 MINUTES PLEASE!! PLEASE ANSWER ASAP!! NEED ONLY ANSWER OF LETTER CHOICES. NO EXPLANATIONS NEEDED PLEASE HELP!! 1) Which data structure
NEED ANSWERS IN NEXT 5 MINUTES PLEASE!! PLEASE ANSWER ASAP!! NEED ONLY ANSWER OF LETTER CHOICES. NO EXPLANATIONS NEEDED PLEASE HELP!!
1) Which data structure provides the best big O time complexity for the operation of finding the minimum value?
a. | a linked list | |
b. | a binary search tree | |
c. | a heap | |
d. | a vector |
2) What is the Big O time complexity of checking if any of the top 10 elements of a stack of strings are the empty string?
a. | O(n) | |
b. | O(log n) | |
c. | O(n2) | |
d. | O(1) |
3)
What is the Big O time complexity of checking if a list of numbers is sorted in descending order?
a. | O(1) | |
b. | O(n) | |
c. | O(n2) | |
d. | O(log n) |
4)
What would be wrong with modifying the UnsortedType class as follows?
private: ItemType * info; // CHANGE: make the array a pointer int length; // rest of fields are unchanged from the current version of the code public: UnsortedType(ItemType *vals, int lgth) { // CHANGE: pass in array info = vals; length = lgth; } // leave rest alone
a. | The constructor should allocate a new array and copy the elements of the parameter into this new array | |
b. | info should still be an array instead of a pointer | |
c. | the array parameter to the constructor might have fewer than 5 elements | |
d. | The new version of UnsortedType is fine |
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