Back to course home
0% completed
Vote For New Content
Isn't every element processed twice?
SHLOK KOTHARI
Apr 7, 2024
I ask this question to ensure I understand the solution correctly. In a scenario where array elements are in a descending order and the max is placed at the last position, we will be required to travel the array twice. The number of times we process each entry is twice. Does this mean the time complexity is 2N?
I understand that big O would be O(n), however would like to ensure I am thinking right.
0
0
Comments
Comments
Shubham Voraa year ago
Yes, you are right!
On this page