Computer Science E-50a: Introduction to Computer Science Using Java

Arrays Bubble Sort Binary Search & Recursion -----------------------------------------------------------------------This is the last unit and WILL NOT be covered in strict order -----------------------------------------------------------------------/* PROBLEM: Sort a list of integers.

SUBPROBLEM: How do we store the integers. Answer: In an Array. -- Think of an Array as a list of objects all of the same type.

int [] list = new int [5]; int int [] int [] list int [] list = new

int [] list = new int [5];

= 0) System.out.println ("Found " + i + " at location " + itemLoc); else System.out.println ("Sorry -- we couldnt find " + i + " in the array!");

}

}

System.out.print ("Want to search for another value? [yes or no] "); response = e50Input.readChar(); e50Input.flushLine(); } while (response != 'N' && response != 'n');

Unit 4: Arrays and Binary Search

Page 314

Dr. S. J. Eigen

Computer Science E-50a: Introduction to Computer Science Using Java

/* file == MakeFileIntegers.java DEMO: Making a file of random integers for use in other programs. Explanation:

e50FileOutput f = new e50FileOutput( "RandomIntegers.data" ); e50FileOutput