public int find(long searchKey) int lowerBound int upperBound nElems-1; int curI
ID: 3725700 • Letter: P
Question
public int find(long searchKey) int lowerBound int upperBound nElems-1; int curIn; 2 while(true) 6 7 curIn (lowerBoundupperBound if(a[ curIn)-#5earchKey) 12; return curIn /found it else if (lowerBound upperBound) return nElems; // can't find it 11 divide range 2 else Looking at the following code, write the missing piece of code: lowerBound curIn 1; // it's in upper half else 6 8 upperBound-curIn 1; 1/ it's in lower half )/I end else divide range / end while 11 end find /linsert using linear insert average N steps HTML Editor ParagraphExplanation / Answer
Answer: if (searchKey > a[curIn])
if (searchKey > a[curIn]) statement was missing in the given code.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.