Question: Looking at the following code, write the missing piece of code: public int find(long searchKey) {int lowerBound = 0; int upperBound = nEleros-1; int curln;

Looking at the following code, write the missing piece of code: public int find(long searchKey) {int lowerBound = 0; int upperBound = nEleros-1; int curln; while(true) {curln = (lowerBound + upperBound)/2; if(a[curIn]==searchKey) return curln;//found it else if(lowerBound > upperBound) return nElems;//can't find it else//divide range lowerBound = curln + 1;//it's in upper half else upperBound = curln - 1;//it's in lower half}//end else divide range}//end while}//end find()////insert using linear insert - average N steps
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
