Question
What would be wrong with modifying the UnsortedType class as follows? private: ItemType * info; // CHANGE: make the array a pointer int length; //
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. | The new version of UnsortedType is fine | |
c. | the array parameter to the constructor might have fewer than 5 elements | |
d. | info should still be an array instead of a pointer |
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(1) | |
b. | O(2A*D*E) | |
c. | O(A+D+E) | |
d. | O(A*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