I am trying to search a descending sorted array using this binary search code. However, after I sort it, and try to search, it doesn\'t come back with any result, just a loading
public static object BinnarySearch(int[] array,int SearchKey) { int min = 0; int max = array.Length - 1; while (min <= max) { int mid = (min + max) / 2; if (SearchKey == array[mid]) { return mid; } else if (SearchKey < array[mid]) { max = mid - 1; } else min = mid + 1; } return "Not Found"; }