The code to answer exercise 91 is below however it is incorr
The code to answer exercise 9.1 is below; however, it is incorrect. What changes do I need to make so that the value 38 is found in the variable \"akey\" at index 0?
Sorry incorrect, the value in akey 38 was NOT found in the array at index 0 Return to Exercise Close Window Your Code with color highlights added) index 0; while (index the array lengt if (akey thea inde array break else if key k the array[index] inde 2 index 1 else index 2 index 2; The Instructions: Exercise 9.1 Search ID Binary Tree Array The ID array thearray contains a binary tree with the root at index -0 Write a while loop to search for the value in the variable akey Write an ifelse to change the variable index to search the left or right child When the loop completes index must be the slot that equals variable akey Do not declare the variable index, but do initialize and change it during the search. Help Type this in first, then back up and fill it out: while f if elseSolution
first=0;last=n-1,
mid=(first+last/2);
while (first<=last)
{
if(thearray[mid]<akey)
//search in upper half
{
first=mid+1;
}
else
//search in lower half of array
{
last=mid-1;
}
}
