public class StaticSETofInts extends Object
The rank and contains operations take logarithmic time in the worst case.
For additional documentation, see Section 1.2 of Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne.
| Constructor and Description |
|---|
StaticSETofInts(int[] keys)
Initializes a set of integers specified by the integer array.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(int key)
Is the key in this set of integers?
|
int |
rank(int key)
Returns either the index of the search key in the sorted array
(if the key is in the set) or -1 (if the key is not in the set).
|
public StaticSETofInts(int[] keys)
keys - the array of integersIllegalArgumentException - if the array contains duplicate integerspublic boolean contains(int key)
key - the search keypublic int rank(int key)
key - the search keyCopyright © 2025. All Rights Reserved.