+1 vote
in Data Structures & Algorithms I by (110k points)
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

I would like to ask this question from Arrays Types in section Arrays Types of Data Structures & Algorithms I

This question was posed to me in examination.

1 Answer

+1 vote
by (408k points)
selected by
Best answer
Right answer is (a) rotate elements one by one

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

Related questions

Welcome to TalkJarvis QnA, a question-answer community website for the people by the people. On TalkJarvis QnA you can ask your doubts, curiosity, questions and whatever going in your mind either related to studies or others. Experts and people from different fields will answer.