_61_380

package
v0.0.0-...-54ead48 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2024 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 RandomizedSet

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

*

@author: CodeWater
@since: 2023/12/23
@desc: O(1) 时间插入、删除和获取随机元素

*

func Constructor

func Constructor() RandomizedSet

func (*RandomizedSet) GetRandom

func (this *RandomizedSet) GetRandom() int

func (*RandomizedSet) Insert

func (this *RandomizedSet) Insert(val int) bool

func (*RandomizedSet) Remove

func (this *RandomizedSet) Remove(val int) bool

Remove 删除O(1)实现:把删除的元素交换到最后,然后删除最后一个元素即可。

Jump to

Keyboard shortcuts

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