Advertisement
Guest User

fuck me daddy

a guest
Mar 1st, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1.  
  2. public class Search {
  3. public static void main(String[] args){
  4. int[] x = {};
  5. double[] y = {};
  6.  
  7. }
  8.  
  9. public static int recursiveBinarySearch(int[] list, int key){
  10. int start = 0;
  11. int end = list.length;
  12. return recursiveBinarySearch(list, start, end, key);
  13. }
  14.  
  15. public static int recursiveBinarySearch(int[] list, int start, int end, int key) {
  16.  
  17. if (start < end) {
  18. int mid = start + (end - start) / 2;
  19. if (key < list[mid]) {
  20. return recursiveBinarySearch(list, start, mid, key);
  21. } else if (key > list[mid]) {
  22. return recursiveBinarySearch(list, mid+1, end , key);
  23. } else {
  24. return mid;
  25. }
  26. }
  27. return -(start + 1);
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement