the solution to programming project 3 use LinkedList Koffman
the solution to programming project #3 (use LinkedList). (Koffman page 145), chapter 2, book; \"Data structures abstraction and design using java\" second edition. complete solution plus a tester
Solution
A)
class OrdArray
 {
 private long[] a;
 private int nelems;
 {
 a = new long[max];
 nelems = 0;
 }
 public int size()
 { return nelems; }
 public int find(long searchKey)
 {
 int lowerBound = 0;
 int upperBound = nelems-1;
 int curIn;
 while(true)
 {
 curIn = (lowerBound + upperBound ) / 2;
 if(a[curIn]==searchKey)
 return curIn;
 else if(lowerBound > upperBound)
 return nElems;
 else
 {
 if(a[curIn] < searchKey)
 lowerBound = curIn + 1;
 else
 upperBound = curIn - 1;
 }
 }
 }

