This set of Data Structures & Algorithms Multiple Choice Questions & Answers (MCQs) focuses on “Cycle Sort”.

1. Which of the following is an example of an unstable sorting algorithm?

a) cycle sort

b) insertion sort

c) bubble sort

d) merge sort

View Answer

Explanation: Out of the given options only cycle sort is an unstable sorting algorithm. This implies that the relative position of equal valued elements in the input and sorted array does not remain the same when we use cycle sort.

2. What is the worst case time complexity of cycle sort?

a) O(n)

b) O(log n)

c) O(n log n)

d) O(n^{2})

View Answer

Explanation: The worst case performance of cycle sort is O(n

^{2}). It is because it has to make n comparisons for each element of the array.

3. What is the auxiliary space requirement of cycle sort?

a) O(n)

b) O(1)

c) O(log n)

d) O(n log n)

View Answer

Explanation: Cycle sort requires an auxiliary space of O(1). So this makes it an in-place sorting algorithm.

4. What is the best case time complexity of cycle sort?

a) O(n^{2})

b) O(n)

c) O(n log n)

d) O(1)

View Answer

Explanation: Best case time complexity of cycle sort is O(n

^{2}). This shows that cycle sort is not an adaptive sorting algorithm and thus makes it undesirable when the given array is already almost sorted.

5. What is the average case time complexity of cycle sort?

a) O(n^{2})

b) O(n log n)

c) O(log n)

d) O(n)

View Answer

Explanation: The average case performance of cycle sort is O(n

^{2}). It is because it has to make n comparisons for each element of the array.

6. Cycle sort is an adaptive sorting algorithm.

a) true

b) false

View Answer

Explanation: The time complexity of cycle sort is O(n

^{2}) in any case. So cycle sort algorithm is not adaptive, as it will take the same time to sort an already sorted array and any other randomly arranged array.

7. Which of the following sorting algorithm is in-place?

a) Merge sort

b) Cycle sort

c) Counting sort

d) Radix sort

View Answer

Explanation: Cycle sort has an auxiliary space complexity of O(1). So it qualifies to be an in-place sort. All other given options are not in place sorting algorithm.

8. Which of the following is an advantage of cycle sort?

a) it can sort large arrays efficiently

b) it has a low time complexity

c) it requires minimal write operations

d) it is an adaptive sorting algorithm

View Answer

Explanation: Cycle sort is a slow sorting algorithm as compared to quick sort, merge sort etc. and is also not adaptive. But it offers an advantage that it performs minimal write operations which can be very useful in a situation where the write operation is expensive.

9. Cycle sort is a comparison based sort.

a) true

b) false

View Answer

Explanation: Cycle sort is a comparison based sorting algorithm. This is because it compares elements in order to sort them.

10. Which of the following sorting algorithm uses the method of insertion?

a) cycle sort

b) bubble sort

c) quick sort

d) selection sort

View Answer

Explanation: Cycle sort is the only algorithm from the given ones that uses the method of insertion. Other than this, insertion sort also uses the method of insertion for sorting.

11. How many write operations will be required to sort the array arr={2,4,3,5,1} using cycle sort?

a) 4

b) 5

c) 6

d) 3

View Answer

Explanation: Cycle sort requires a minimum number of write operations in order to sort a given array. So in this case, only 4 write operations will be required.

12. Which of the following algorithm is best suited for the case where swap operation is expensive?

a) bubble sort

b) cycle sort

c) cocktail sort

d) merge sort

View Answer

Explanation: Cycle sort is a slow sorting algorithm but it requires a minimum number of write operations in order to sort a given array. So it is useful when the write/swap operation is expensive.

**Sanfoundry Global Education & Learning Series – Data Structures & Algorithms.**

To practice all areas of Data Structures & Algorithms, __here is complete set of 1000+ Multiple Choice Questions and Answers__.