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

The code to answer exercise 9.1 is below; however, it is incorrect. What changes

ID: 3778127 • Letter: T

Question

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 else

Explanation / Answer

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;

}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote