Binary Search
Binary Search
1.1 Search in Rotated Sorted Array

Finding elements in the array is a very easy problem, we can use linear search to find elements in O(N) time complexity.

Search in Rotated Sorted Array :

Intuition:

2. Now if the sorted array is on the left side then compare the target with the mid and 0 th element to reduce the search space.

3. else if the sorted array is on the right side then compare the target with the mid and n-1 th element to reduce the search space.

public int search1(final int[] A, int B) { int n =…


  1. Check the python is install using the following command.

conda — version

satish kathiriya

Associate Software Engineer | JP Morgan & Chase

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store