template

package module
v0.0.0-...-d78a9e0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: MIT Imports: 3 Imported by: 11

Documentation

Index

Constants

View Source
const (
	// MoveToFront define
	MoveToFront command = iota
	// PushFront define
	PushFront
	// Delete define
	Delete
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BinaryIndexedTree

type BinaryIndexedTree struct {
	// contains filtered or unexported fields
}

BinaryIndexedTree define

func (*BinaryIndexedTree) Add

func (bit *BinaryIndexedTree) Add(index int, val int)

Add define

func (*BinaryIndexedTree) Init

func (bit *BinaryIndexedTree) Init(capacity int)

Init define

func (*BinaryIndexedTree) InitWithNums

func (bit *BinaryIndexedTree) InitWithNums(nums []int)

InitWithNums define

func (*BinaryIndexedTree) Query

func (bit *BinaryIndexedTree) Query(index int) int

Query define

type BinaryIndexedTree2D

type BinaryIndexedTree2D struct {
	// contains filtered or unexported fields
}

BinaryIndexedTree2D define

func (*BinaryIndexedTree2D) Add

func (bit2 *BinaryIndexedTree2D) Add(i, j int, val int)

Add define

func (*BinaryIndexedTree2D) Query

func (bit2 *BinaryIndexedTree2D) Query(i, j int) int

Query define

type CLRUCache

type CLRUCache struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

CLRUCache define: High Concurrency LRUCache

func New

func New(capacity int) *CLRUCache

New define

func (*CLRUCache) Clear

func (c *CLRUCache) Clear()

Clear define

func (*CLRUCache) Count

func (c *CLRUCache) Count() int

Count define

func (*CLRUCache) Delete

func (c *CLRUCache) Delete(key string) bool

Delete define

func (*CLRUCache) Get

func (c *CLRUCache) Get(key string) interface{}

Get define

func (*CLRUCache) Put

func (c *CLRUCache) Put(key string, value interface{})

Put define

type LFUCache

type LFUCache struct {
	// contains filtered or unexported fields
}

LFUCache define

func Constructor

func Constructor(capacity int) LFUCache

Constructor define

func (*LFUCache) Get

func (lfuCache *LFUCache) Get(key int) int

Get define

func (*LFUCache) Put

func (lfuCache *LFUCache) Put(key int, value int)

Put define

type LRUCache

type LRUCache struct {
	// contains filtered or unexported fields
}

LRUCache define

func ConstructorLRU

func ConstructorLRU(capacity int) LRUCache

ConstructorLRU define

func (*LRUCache) Add

func (lruCache *LRUCache) Add(node *Node)

Add define

func (*LRUCache) Get

func (lruCache *LRUCache) Get(key int) int

Get define

func (*LRUCache) Put

func (lruCache *LRUCache) Put(key int, value int)

Put define

func (*LRUCache) Remove

func (lruCache *LRUCache) Remove(node *Node)

Remove define

type Node

type Node struct {
	// contains filtered or unexported fields
}

Node define

type Pair

type Pair struct {
	// contains filtered or unexported fields
}

Pair define

type SegmentCountTree

type SegmentCountTree struct {
	// contains filtered or unexported fields
}

SegmentCountTree define

func (*SegmentCountTree) Init

func (st *SegmentCountTree) Init(nums []int, oper func(i, j int) int)

Init define

func (*SegmentCountTree) Query

func (st *SegmentCountTree) Query(left, right int) int

Query define

func (*SegmentCountTree) UpdateCount

func (st *SegmentCountTree) UpdateCount(val int)

UpdateCount define

type SegmentTree

type SegmentTree struct {
	// contains filtered or unexported fields
}

SegmentTree define

func (*SegmentTree) Init

func (st *SegmentTree) Init(nums []int, oper func(i, j int) int)

Init define

func (*SegmentTree) Query

func (st *SegmentTree) Query(left, right int) int

Query define

func (*SegmentTree) QueryLazy

func (st *SegmentTree) QueryLazy(left, right int) int

QueryLazy define

func (*SegmentTree) Update

func (st *SegmentTree) Update(index, val int)

Update define

func (*SegmentTree) UpdateLazy

func (st *SegmentTree) UpdateLazy(updateLeft, updateRight, val int)

UpdateLazy define

type UnionFind

type UnionFind struct {
	// contains filtered or unexported fields
}

UnionFind defind 路径压缩 + 秩优化

func (*UnionFind) Find

func (uf *UnionFind) Find(p int) int

Find define

func (*UnionFind) Init

func (uf *UnionFind) Init(n int)

Init define

func (*UnionFind) TotalCount

func (uf *UnionFind) TotalCount() int

TotalCount define

func (*UnionFind) Union

func (uf *UnionFind) Union(p, q int)

Union define

type UnionFindCount

type UnionFindCount struct {
	// contains filtered or unexported fields
}

UnionFindCount define 计算每个集合中元素的个数 + 最大集合元素个数

func (*UnionFindCount) Count

func (uf *UnionFindCount) Count() []int

Count define

func (*UnionFindCount) Find

func (uf *UnionFindCount) Find(p int) int

Find define

func (*UnionFindCount) Init

func (uf *UnionFindCount) Init(n int)

Init define

func (*UnionFindCount) MaxUnionCount

func (uf *UnionFindCount) MaxUnionCount() int

MaxUnionCount define

func (*UnionFindCount) Union

func (uf *UnionFindCount) Union(p, q int)

Union define

Jump to

Keyboard shortcuts

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