The
TopM class provides a client that reads a sequence of
transactions from standard input and prints the
M largest ones
to standard output. This implementation uses a
MinPQKey of size
at most
M + 1 to identify the
M largest transactions
and a
LinkedStackItem to output them in the proper order.
Inheritance Hierarchy
Namespace: Algs4NetAssembly: Algs4Net (in Algs4Net.dll) Version: 1.0.0.0 (1.0.0.0)
SyntaxThe TopM type exposes the following members.
Methods
| Name | Description |
---|
  | MainTest |
Reads a sequence of transactions from standard input; takes a
command-line integer M; prints to standard output the M largest
transactions in descending order. |
Top
Remarks
For additional documentation, see
Section 2.4
of
Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne.
This class is a C# port from the original Java class
TopM implementation by
Robert Sedgewick and Kevin Wayne.
See Also