Pointers
October 28, 2023Sorting
October 28, 2023Sorting
Question 82
|
An ideal sort is an in-place-sort whose additional space requirement is __________.
O (log 2 n)
|
|
O (n log 2 n)
|
|
O (1)
|
|
O (n)
|
Question 82 Explanation:
The ideal sorting algorithm would have the following properties:
1. Stable: Equal keys aren’t reordered.
2. Operates in place, requiring O(1) extra space.
3. Worst case O(nlog(n)) key comparisons.
4. Worst case O(n) swaps.
5. Adaptive: Speeds up to O(n) when data is nearly sorted or when there are few unique keys.
1. Stable: Equal keys aren’t reordered.
2. Operates in place, requiring O(1) extra space.
3. Worst case O(nlog(n)) key comparisons.
4. Worst case O(n) swaps.
5. Adaptive: Speeds up to O(n) when data is nearly sorted or when there are few unique keys.
Correct Answer: C
Question 82 Explanation:
The ideal sorting algorithm would have the following properties:
1. Stable: Equal keys aren’t reordered.
2. Operates in place, requiring O(1) extra space.
3. Worst case O(nlog(n)) key comparisons.
4. Worst case O(n) swaps.
5. Adaptive: Speeds up to O(n) when data is nearly sorted or when there are few unique keys.
1. Stable: Equal keys aren’t reordered.
2. Operates in place, requiring O(1) extra space.
3. Worst case O(nlog(n)) key comparisons.
4. Worst case O(n) swaps.
5. Adaptive: Speeds up to O(n) when data is nearly sorted or when there are few unique keys.
Subscribe
Login
0 Comments