public class BinarySearch extends Object
The rank operations takes logarithmic time in the worst case.
For additional documentation, see Section 1.1 of Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne.
| Modifier and Type | Method and Description |
|---|---|
static void |
main(String[] args)
Reads in a sequence of integers from the whitelist file, specified as
a command-line argument.
|
static int |
rank(int key,
int[] a)
Searches for the integer key in the sorted array a[].
|
public static int rank(int key,
int[] a)
key - the search keya - the array of integers, must be sorted in ascending orderpublic static void main(String[] args)
Copyright © 2025. All Rights Reserved.