container

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PQNode

type PQNode struct {
	// 최소 힙(Min Heap)을 사용
	// 최소 힙에서는 부모 노드의 값이 자식 노드의 값보다 항상 작거나 같아야 합니다.
	Priority int
	// contains filtered or unexported fields
}

type PriorityQueue

type PriorityQueue interface {

	// Push add a new node
	Push(*PQNode) error

	// Pop remove the highest priority node and return it
	Pop() *PQNode

	// Len return length of q
	Len() int
}

PriorityQueue is a Priority queue based on a min heap.

func NewPriorityQueue

func NewPriorityQueue(capacity int) PriorityQueue

NewPriorityQueue returns a new PriorityQueue.

type Set

type Set[T comparable] map[T]bool

func NewSet

func NewSet[T comparable]() Set[T]

NewSet 새로운 Set 생성

func (Set[T]) Copy

func (s Set[T]) Copy() Set[T]

func (Set[T]) Difference

func (s Set[T]) Difference(other Set[T]) Set[T]

Difference 차집합 연산

func (Set[T]) Equals

func (s Set[T]) Equals(other Set[T]) bool

Equals 서로 동일한지 판별하는 함수

func (Set[T]) Has

func (s Set[T]) Has(element T) bool

Has 포함 여부 확인

func (Set[T]) Insert

func (s Set[T]) Insert(element T)

Insert 존재하지 않으면 추가, 존재하면 업데이트

func (Set[T]) Intersection

func (s Set[T]) Intersection(other Set[T]) Set[T]

Intersection 교집합 연산

func (Set[T]) Iterate

func (s Set[T]) Iterate() []T

Iterate 순회

func (Set[T]) Len

func (s Set[T]) Len() int

Len 크기 반환

func (Set[T]) Remove

func (s Set[T]) Remove(element T)

Remove 삭제 연산

func (Set[T]) SymmetricDifference

func (s Set[T]) SymmetricDifference(other Set[T]) Set[T]

SymmetricDifference 대칭 차집합 연산, 두 Set 중 하나에만 포함된 요소

func (Set[T]) Union

func (s Set[T]) Union(other Set[T]) Set[T]

Union 합집합 연산

type SortedMap

type SortedMap[K cmp.Ordered, V any] map[K]V

func (*SortedMap[K, V]) SortedKeys

func (c *SortedMap[K, V]) SortedKeys(cmp func(a, b K) int) []K

type SortedSet

type SortedSet[T cmp.Ordered] map[T]bool

func NewSortedSet

func NewSortedSet[T cmp.Ordered]() SortedSet[T]

NewSortedSet 새로운 SortedSet 생성

func (SortedSet[T]) Difference

func (s SortedSet[T]) Difference(other SortedSet[T]) SortedSet[T]

Difference 차집합 연산

func (SortedSet[T]) Equals

func (s SortedSet[T]) Equals(other SortedSet[T]) bool

Equals 서로 동일한지 판별하는 함수

func (SortedSet[T]) Has

func (s SortedSet[T]) Has(element T) bool

Has 포함 여부 확인

func (SortedSet[T]) Insert

func (s SortedSet[T]) Insert(element T)

Insert 삽입 연산

func (SortedSet[T]) Intersection

func (s SortedSet[T]) Intersection(other SortedSet[T]) SortedSet[T]

Intersection 교집합 연산

func (SortedSet[T]) Iterate

func (s SortedSet[T]) Iterate() []T

Iterate 순회

func (SortedSet[T]) Len

func (s SortedSet[T]) Len() int

Len 크기 반환

func (SortedSet[T]) Remove

func (s SortedSet[T]) Remove(element T)

Remove 삭제 연산

func (SortedSet[T]) SymmetricDifference

func (s SortedSet[T]) SymmetricDifference(other SortedSet[T]) SortedSet[T]

SymmetricDifference 대칭 차집합 연산, 두 Set 중 하나에만 포함된 요소

func (SortedSet[T]) Union

func (s SortedSet[T]) Union(other SortedSet[T]) SortedSet[T]

Union 합집합 연산

Jump to

Keyboard shortcuts

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