Computer Science, asked by noopursonaje, 7 months ago

 A sorted array has 10 elements. Find out the total number of comparisons needed, if every search is successful to find the item in binary search manner?​

Answers

Answered by rameshshyampuram
1

sorry I didn't know the answer

Answered by mahatokanchan915
0

Given an array of n distinct integers and an element x. Search the element x in the array using minimum number of comparisons. Any sort of comparison will contribute 1 to the count of comparisons. For example, the condition used to terminate a loop, will also contribute 1 to the count of comparisons each time it gets executed. Expressions like while (n) {n–;} also contribute to the count of comparisons as value of n is being compared internally so as to decide whether or not to terminate the loop.

Examples:

Input : arr[] = {4, 6, 1, 5, 8},

x = 1

Output : Found

Input : arr[] = {10, 3, 12, 7, 2, 11, 9},

x = 15

Output : Not Found

Similar questions