Documentation ¶
Overview ¶
Package heaps implements solutions for the problems described in the chapter Heaps of the book Elements of Programming Interview.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MedianStream ¶
MedianStream reads the stream of values from in channel, computes a median from first n read values, and write the result after every read entry to out channel. The time complexity per read entry is O(log(n)). The O(n) additional space is needed for the first n read entries.
func MergeSorted ¶
MergeSorted merges given slice of already sorted slices into one sorted slice. The time complexity is O(n*log(k)) where n is the total number of elements combining all slices together and k = len(ss). The O(k) additional space is needed (beyond the space needed to write the final result).
Types ¶
This section is empty.