StaticSETofInts Class |
The StaticSETofInts class represents a set of integers. It supports searching for a given integer is in the set. It accomplishes this by keeping the set of integers in a sorted array and using binary search to find the given integer.
The Rank and Contains operations take logarithmic time in the worst case.
Namespace: Algs4Net
public class StaticSETofInts
The StaticSETofInts type exposes the following members.
Name | Description | |
---|---|---|
![]() | StaticSETofInts | Initializes a set of integers specified by the integer array. |
Name | Description | |
---|---|---|
![]() | Contains |
Is the key in this set of integers? |
![]() ![]() | MainTest |
Demo test for the StaticSETofInts data type. |
![]() | Rank |
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). |
For additional documentation, see Section 1.2 of Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne.
This class is a C# port from the original Java class StaticSETofInts implementation by the respective authors.