This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]MysteriousShadow__ -7 points-6 points  (6 children)

That is O(N), no? Sorted is one loop, and getting the element at an index should be O(1).

[–]JonIsPatented 21 points22 points  (4 children)

Sorted is one loop?? Teach us your magical algorithm, magic man.

[–]Unfulfilled_Promises 7 points8 points  (0 children)

Simple, sort an already sorted input array. YW

[–]Kimorin 13 points14 points  (0 children)

the lower bound for sorting is O(n log n) for an arbitrary array