heap

package
v0.0.0-...-830326e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 17, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MaxHeap

type MaxHeap []WordCount

func (MaxHeap) Len

func (h MaxHeap) Len() int

func (MaxHeap) Less

func (h MaxHeap) Less(i, j int) bool

func (*MaxHeap) Pop

func (h *MaxHeap) Pop() interface{}

func (*MaxHeap) Push

func (h *MaxHeap) Push(x interface{})

func (MaxHeap) Swap

func (h MaxHeap) Swap(i, j int)

type WordCount

type WordCount struct {
	Word  string
	Count int
}

func PopKLargestWordCounts

func PopKLargestWordCounts(maxHeap *MaxHeap, k int) []WordCount

PopKLargestWordCounts pops k largest word counts from maxHeap

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL