11944 - (電機系呂老師班上機考) Partition Step of QuickSort
|
Time |
Memory |
| Case 1 |
1 sec |
32 MB |
| Case 2 |
1 sec |
32 MB |
| Case 3 |
1 sec |
32 MB |
| Case 4 |
1 sec |
32 MB |
| Case 5 |
1 sec |
32 MB |
| Case 6 |
1 sec |
32 MB |
| Case 7 |
1 sec |
32 MB |
| Case 8 |
1 sec |
32 MB |
Description
- Given
- List of distinct integers
- Required order: ascending (由小到大) or descending (由大到小)
- 測資 1~6 是 ascending (由小到大),佔120%
- 測資 7~8 是 descending (由大到小),佔40%
- 測資 1 就是 sample input/output
- Perform the partition step of QuickSort once
- Use the last number as the pivot
- Do swaps to partition the list according to the pivot
- Print out the list
- Ascending (由小到大) Example

- Descending (由大到小) Example

Input

Output

Tags