Click or drag to resize
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.

Inheritance Hierarchy
SystemObject
  Algs4NetStaticSETofInts

Namespace: Algs4Net
Assembly: Algs4Net (in Algs4Net.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
C#
public class StaticSETofInts

The StaticSETofInts type exposes the following members.

Constructors
  NameDescription
Public methodStaticSETofInts
Initializes a set of integers specified by the integer array.
Top
Methods
  NameDescription
Public methodContains
Is the key in this set of integers?
Public methodStatic memberMainTest
Demo test for the StaticSETofInts data type.
Public methodRank
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).
Top
Remarks

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.

See Also