Knowee
Questions
Features
Study Tools

Multi Choice Type QuestionWhat are the mid values (corresponding array items) produced in the first and second iterations for an array arr = [12, 24, 36, 48, 60, 72, 84] and key = 84?Marks : 1Negative Marks : 0Answer here36 and 6024 and 3660 and 7248 and 72

Question

Multi Choice Type QuestionWhat are the mid values (corresponding array items) produced in the first and second iterations for an array arr = [12, 24, 36, 48, 60, 72, 84] and key = 84?Marks : 1Negative Marks : 0Answer here36 and 6024 and 3660 and 7248 and 72

🧐 Not the exact question you are looking for?Go ask a question

Solution

The question is about the Binary Search algorithm. In Binary Search, we take the middle element of the array and compare it with the key. If the key is equal to the middle element, we have found the key. If the key is less than the middle element, we repeat the process with the left half of the array. If the key is greater than the middle element, we repeat the process with the right half of the array.

The array given is arr = [12, 24, 36, 48, 60, 72, 84] and the key is 84.

In the first iteration, the middle element is 48 (the fourth element). The key 84 is greater than 48, so we discard the left half of the array and repeat the process with the right half [60, 72, 84].

In the second iteration, the middle element of the new array [60, 72, 84] is 72 (the second element). The key 84 is greater than 72, so we discard the left half of the array and repeat the process with the right half [84].

So, the mid values produced in the first and second iterations are 48 and 72. Therefore, the correct answer is "48 and 72".

This problem has been solved

Similar Questions

Given an array arr = {45,77,89,90,94,99,100} and key = 100; What are the mid values(corresponding array elements) generated in the first and second iterations?Options90 and 9989 and 9494 and 9990 and 100

Given an array arr = {35,40, 45,77,89,90,94,99,100} and key = 99; what are the mid values(corresponding array elements) in the first and second levels of recursion? Options 90 and 99 90 and 94 89 and 94 91 and 94

Multi Choice Type QuestionWhich of the following is a valid operation on a 1D array?Marks : 1Negative Marks : 0Answer hereInserting at the frontInserting in the middleDeleting in the frontAll of the mentioned options

Given, arr = {1,3,5,6,7,9,14,15,17,19} key = 17 and delta = {5,3,1,0}How many key comparisons are made?(exclude the comparison used to decide the left or right sub array)Options6345

Given the array declaration int arr[5] = {1, 2, 3};, what are the values of arr[3] and arr[4]?Both arr[3] and arr[4] are 0Both arr[3] and arr[4] are uninitializedarr[3] is 3 and arr[4] is 3arr[3] is 2 and arr[4] is 2

1/1

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.