+1 vote
in Data Structures & Algorithms I by (110k points)
What is the minimum possible time complexity to find the number of steps to reach the end of an array?

(a) O(n)

(b) O(n^2)

(c) O(n^3/2)

(d) O(1)

My question comes from Number of Jumps to Reach End-array Operation topic in chapter Arrays Types of Data Structures & Algorithms I

I have been asked this question during an interview.

1 Answer

+1 vote
by (408k points)
selected by
Best answer
Right choice is (a) O(n)

Easy explanation - The minimum possible time complexity to reach the end of an array is O(n). So a linear time complexity is possible.

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.