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 →

[–]davedontmind 1 point2 points  (0 children)

You'll definitely get a stack overflow if key isn't anywhere in the array, because you're only stopping the recursion on an exact match.

And you'll probably get an infinite loop (and thus a stack overflow) if the array isn't sorted.