FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

GitHub Viewer

public class BinarySearch { public static int binarySearch(int arr[], int low, int high, int key) { int mid = (low + high) / 2; while (low high) { return -1; } return -1; } public static void main(String[] args) { int intArray[] = {7, 8, 9}; int key = 8; if (binarySearch(intArray, 0, 5, key) != -1) { System.out.print("searching `"); System.out.print(key); System.out.print("` in the array... it's at index "); System.out.println(binarySearch(intArray, 0, 5, key)); } else { System.out.println("index not found"); } } }

Back | FazBrowse Home | New Git URL