maxheap

package
v0.0.0-...-3b2a8e7 Latest Latest
Warning

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

Go to latest
Published: May 18, 2022 License: MIT Imports: 2 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 struct {
	// contains filtered or unexported fields
}

最大堆

func Constructor

func Constructor(capacity int) *MaxHeap

func GetMaxHeapFromArr

func GetMaxHeapFromArr(arr []interface{}) *MaxHeap

func (*MaxHeap) Add

func (h *MaxHeap) Add(e interface{})

func (*MaxHeap) FindMax

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

func (*MaxHeap) GetSize

func (h *MaxHeap) GetSize() int

func (*MaxHeap) IsEmpty

func (h *MaxHeap) IsEmpty() bool

func (*MaxHeap) Remove

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

最大堆删除的都是堆顶元素

func (*MaxHeap) Replace

func (h *MaxHeap) Replace(e interface{}) interface{}

替换堆的最大元素,并返回被替换的元素值

func (*MaxHeap) SiftDown

func (h *MaxHeap) SiftDown(index int)

func (*MaxHeap) SiftUp

func (h *MaxHeap) SiftUp(index int)

Jump to

Keyboard shortcuts

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