// Page 180-182 import java.util.Scanner; public class SortedList { final int MAX = 50; private int[] data = new int[MAX]; private int length; public SortedList() { length = 0; } public int Length() { return length; } public boolean IsEmpty () { return length == 0; } public boolean IsPresent (int item) { int position = posBinarySearch(item); if (position<0) return false; else return true; } public void Print () { for (int k=0; k=first && !found) { middle = (first + last) / 2; if ( item < data[middle] ) // located first half last = middle - 1; else if ( item > data[middle] )// located last half first = middle + 1; else found = true; } // found or not find (last < first) if(found) position = middle; return position; } public static void main(String[] args) { Scanner input=new Scanner(System.in); int item; int[] b = {2, 5, 7, 11, 14, 16, 18, 30}; SortedList myList = new SortedList(); for(int i=0; i