Looking at the following code write the missing piece of cod

Looking at the following code, write the missing piece of code://................-............................. public int find(long searchKey) {int lowerBound = 0; int upperBound = nElems-1; int curIn; while(true) {curln = (lowerBound + upperBound)/2; if(a[curln]==searchKey) return curIn;//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

Solution

Missing part:

if(a[curIn] < searchKey)

Note:Please let me know in case of any doubt,Thanks.

 Looking at the following code, write the missing piece of code://................-............................. public int find(long searchKey) {int lowerBound

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site