[Solved] Which of the following algorithm to rotate an array has the maximum time complexity?

Which of the following algorithm to rotate an array has the maximum time complexity?

a) rotate elements one by one
b) juggling algorithm
c) reversal algorithm
d) using a temporary array

Answer: a
Explanation: The maximum time complexity is required by the algorithm that rotates elements one by one. It requires O(n*d) time.

Comments