Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

please use a binary search to show the process of search for 115inthis array of

ID: 3644529 • Letter: P

Question

please use a binary search to show the process of search for 115inthis array of integers please show the steps through a binary search tree

18,24,27,36,78,91,101,115
please show all steps thank you

Explanation / Answer

Since the array is sorted we can easily perform binary search... Now in the given array: first element = 18 (position 1) last element = 115(position 8) key = 115 Now we will find middle element using mid mid = (first + last)/2 => (1+8)/2 = 4.5 = 4 therefore middle element is at 4th position which is: 36 Now according to binary search if middle element = key then element found else if "middle element > key" then first element remains same and last element becomes middle element and we repeat the whole process but if "middle element