Facebook Interview Question: Standard rotated binary searc... | Glassdoor

Interview Question

Software Engineer Interview(Student Candidate) Seattle, WA

Standard rotated binary search question. You have a sorted

  array that has been shifted/cycled, perform a search on it

Interview Answer

5 Answers


1) If the array has duplicates, then the best possibility is a linear search
2) if the array has no duplicates, we can do a binary search, using the condition that always one of the two halfs will be always sorted, no matter what is the index of middle.

German on Sep 11, 2014

One or more comments have been removed.
Please see our Community Guidelines or Terms of Service for more information.

Add Answers or Comments

To comment on this, Sign In or Sign Up.