Skip to content

Commit

Permalink
Search in circular array (Amazon, Google, Adobe, Microsoft, Flipkart)
Browse files Browse the repository at this point in the history
  • Loading branch information
AnghelLeonard authored Aug 23, 2020
1 parent 8d42724 commit 270035a
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ public static int find(int[] m, int x) {
} else {
right = middle - 1; // search in the left-half
}
} else { // we conclude that the left-half is sorted (A[left ... middle])
// compare key with A[left] and A[mid] to know
} else { // we conclude that the left-half is sorted (A[left ... middle])

// check if n is in m[left ... middle]
if (x >= m[left] && x < m[middle]) {
Expand Down

0 comments on commit 270035a

Please sign in to comment.