egonSchiele/grokking_algorithms

Binary Search in Java is not working properly without sorting it first.

Opened this issue · 1 comments

public class BinarySearch {
public static void main(String[] args) {
int[] myList = {87, 21, 45, 93};

   //add this line  Arrays.sort(myList);
    System.out.println(binarySearch(myList, 93));

I might be wrong, I am just a newbie