Question
Answer The Following Multiple Choice Questions And Choose the Correct Answer (A-D). Questions 1 & 2 are A-D Multiple Choice & Questions 3 & 4
Answer The Following Multiple Choice Questions And Choose the Correct Answer (A-D). Questions 1 & 2 are A-D Multiple Choice & Questions 3 & 4 - A - C Multiple Choice.
Question 1:
You're measuring the performance of a piece of software, and you're trying to summarise a set of timing results. Which of these descriptive statistics is the best choice if you're trying to get an idea of a typical (expected) timing from your measurements?
Question 1 options:
A. | the minimum |
B. | the mode |
C. | the mean |
D. | the median |
Question 2:
You're writing a program that needs to sort large collections of arbitrary data. Which of the following sorting algorithms is likely to run the slowest?
Question 2 options:
A. | in-place insertion sort |
B. | merge sort |
C. | quicksort |
D. | all of the above will be the same |
Question 3:
Merge sort and quicksort have the same typical time complexity -- O(N log N) -- but different worst-case time complexities: merge sort's worst case is O(N log N), and quicksort's worst case is O(N^2).
If you're writing a program that needs to sort arbitrary input provided by untrusted (and potentially malicious) users, which algorithm would be a better choice?
Question 3 options:
A. | merge sort |
B. | quicksort |
C. | there's no difference between them |
Question 4 (1 point)
The C++ standard library provides several ways to sort a collection.
The std::sort function works on any collection type that has random-access iterators. These are iterators that can be moved to point at any item of a collection in constant time -- this is true for array-based collections like std::array and std::vector.
The std::list collection type doesn't have random-access iterators, so it provides its own sort method instead. You've used this in the lab exercise.
Find the documentation for std::sort and std::list's sort method on cppreference.com (or another site with the C++ specification), and compare the time complexity of the two operations. Which of these is true, based on the time complexities?
Question 4 options:
A. | std::sort is generally more efficient than std::list::sort |
B. | std::list::sort is generally more efficient than std::sort |
C. | they're both the same |
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