Question: 1-If algorithm A requires 2 n + 1 basic operations to process an input of size n , and Algorithm B requires 3 n +
1-If algorithm A requires 2n + 1 basic operations to process an input of size n, and Algorithm B requires
3n + 2 basic operations to process the same input, algorithm A is considered to be more efficient than Algorithm B.
True
False
2- Selection sort can sort a list of values faster if the list already has the following property:
| The list has mostly the same values | ||
| None of these properties causes selection sort to work faster. | ||
| The list is composed of string values | ||
| The list is already sorted |
3-Below are listed several sorting algorithms. Of these, which has the best overall performance?
| quicksort | ||
| cannot be determined | ||
| bubble sort | ||
| selection sort |
4-True/False: Bubble sort and selection sort can also be used with STL vectors.
True
False
5-A sorting algorithm can be used to arrange a set of ________ in ________ order.
| numeric values, descending | ||
| strings, descending | ||
| numeric values, ascending | ||
| strings, ascending | ||
| All of the above
|
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
