Skip to Content
Java How to Program, Early Objects, 11th Edition
book

Java How to Program, Early Objects, 11th Edition

by Paul J. Deitel, Harvey Deitel
June 2017
Beginner
1296 pages
69h 23m
English
Pearson
Content preview from Java How to Program, Early Objects, 11th Edition
... } 23            System.out.println(" * "); // indicate current middle
24
25            // if the element is found at the middle
26            if (key == data[middle]) {
27               location = middle; // location is the current middle
28            }
29            else if (key < data[middle]) { // middle element is too high
30               high = middle - 1; // eliminate the higher half
31            }
32            else { // middle element is too low
33               low = middle + 1; // eliminate the lower half
34            }
35
36            middle = (low + high + 1) / 2; // recalculate the middle
37         } while ((low <= high) && (location == -1));
38
39         return location; // return location of search key
40      }
41
42      // method to output certain values in array
43      private static String remainingElements(
44         int[] data, int low, int high) {
45         StringBuilder temporary = new StringBuilder(); ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17

Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17

Kishori Sharan, Adam L. Davis
Learning Java, 5th Edition

Learning Java, 5th Edition

Marc Loy, Patrick Niemeyer, Daniel Leuck
Java in a Nutshell, 8th Edition

Java in a Nutshell, 8th Edition

Benjamin J. Evans, Jason Clark, David Flanagan

Publisher Resources

ISBN: 9780134751962