MakeContributions / DSA

Data Structure and Algorithm (DSA) contributions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Order agnostic binary search in java

dofywofy opened this issue · comments

Information about Algorithm

Order agnostic binary search is an algorithm where we do not know whether the given sorted array is ascending or descending order. We declare a Boolean variable to find whether the array is ascending order. In the while loop, we use the two pointer method (start and end) to get the middle element., if the middle element is equal to our target element, then that is the answer. If not, then we check if the array is ascending or descending order.
Depending upon the condition, respective statements will be executed and we will get our answer.

Have you read the Contributing.md and Code of conduct

  • Yes
  • No

Other context

This is used in GeeksForGeeks, Leetcode, HackerRank, etc... platforms.

Thanks for opening your first issue here! Be sure to follow the issue template!

May I work on this issue?

I've worked on it already, just waiting for the review.
#1116

Hello. I have solved for the order agnostic binary search. Checkout my code.
#1145

why the code isnt merged yet?