Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

3 sequential numbers

Name: eye 2012-04-04 16:06

Alright geniuses, if you think your programming ability is up to par, lets see you solve this:

Write an algorithm which in O(n) time finds 3 indices i, j, and k such that i < j < k and array[i] < array[j] < array[k].

Name: Anonymous 2012-04-06 23:39

>>52
Ah, I think I see the problem you imply. Input like [5, 3, 4, 6] would fail with the B-tree as stated.  The solution would be thwarted by the last value's branch decision using the root node.  A partial solution is no good; I need to rethink this.

Is that extra level of complexity I didn't account for the B-tree insertion being factored into the big o time?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List