1.

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 arrayI would like to ask this question from Arrays Types in section Arrays Types of Data Structures & Algorithms IThis question was posed to me in examination.

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.



Discussion

No Comment Found

Related InterviewSolutions