Question: please draw a tree of recursive calls for the 3 methods(binary search,factorial,fibonacci) shown. please draw them in correspondence with the data that is in my

 please draw a tree of recursive calls for the 3 methods(binary

please draw a tree of recursive calls for the 3 methods(binary search,factorial,fibonacci) shown. please draw them in correspondence with the data that is in my main method( last method). For each method please find big O notation with a brief explanation why. thank you so much!!

2 3 4 5 6 public static boolean binarySearch(int arr[], int low, int high, int data) { if (high>low) { int mid = low + (high - low) / 2; if(data= arr(mid)) return true; else if(data arr[mid)) return binarySearch(arr, low, mid-1, data); else return binarySearch(arr, mid+1, high, data); 7 8 9 10 11 12 13 14 15 return false; 16 public static int factorial(int n) { if(n==0 || n==1) return 1; return nxfactorial(n-1); 17 18 19 20 21 22 23 24 25 26 27 public static int fibonacci(int n) { //Fibonacci series 0,1,1,2,3,5,8,13, 21, ... if(n==1) return 0; else if(n==2) I return 1: else return fibonacci(n-1)+fibonacci(n-2): } public static void main(String args[]) throws Exception int arr[]={1,4,6,2,7,9,10,13,20}; System.out.println(binarySearch(arr, 0, arr.length-1,20)); System.out.println(factorial(4)); System.out.println(fibonacci(9)); 28 29 30 31 32 33 34 Class compiled - no syntax errors

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!