Documentation ¶
Overview ¶
Package greedy implements solutions for the problems described in the sub-chapter Greedy Algorithms of chapter Greedy Algorithms and Invariants of the book Elements of Programming Interview.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HuffmanEncoding ¶
func HuffmanEncoding(symbols []*Symbol)
HuffmanEncoding assigns huffman code to given symbols based on its given frequency. The time complexity is O(n*log(n))), and O(n) additional space is needed.
func MinWaitingTime ¶
MinWaitingTime returns a time that represents a sum of all the minimum waiting times ordered in a way in which to process queries minimizes time.
Types ¶
Click to show internal directories.
Click to hide internal directories.