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 tree18,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 elementRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.