Documentation
¶
Overview ¶
Package order implements data structures that provide ordered operations like an ordered symbol table as described in the textbook Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Map ¶
Map is an ordered symbol table as described in the textbook Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne. A summary of the API can be found in https://algs4.cs.princeton.edu/31elementary. Map is implemented as a left-leaning red-black binary search tree as described in the paper Left-leaning Red-Black Trees by Robert Sedgewick https://sedgewick.io/wp-content/themes/sedgewick/papers/2008LLRB.pdf. All operations are thus guaranteed to run in O(log N) with N number of keys.
func (*Map[K, V]) All ¶
All returns an in iterator iterating in ascending order over all key-value pairs.
func (*Map[K, V]) Get ¶
Get returns the value associated with the given key and true if the key was found. The zero value and false is returned if the key was not found.
func (*Map[K, V]) Min ¶
Min returns the smallest key in the map and true if the map is not empty. The zero value and false is returned if the map is empty.