Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DisjointSet ¶
type DisjointSet struct {
// contains filtered or unexported fields
}
DisjointSet represents a disjoint-set data structure
func NewDisjointSet ¶
func NewDisjointSet(size int) *DisjointSet
NewDisjointSet creates a new disjoint-set data structure
func (*DisjointSet) Connected ¶
func (ds *DisjointSet) Connected(x, y int) bool
Connected checks if two elements are in the same set
func (*DisjointSet) Find ¶
func (ds *DisjointSet) Find(x int) int
Find finds the representative (root) of the set containing element x Uses path compression for optimization
func (*DisjointSet) GetSetCount ¶
func (ds *DisjointSet) GetSetCount() int
GetSetCount returns the number of disjoint sets
func (*DisjointSet) GetSize ¶
func (ds *DisjointSet) GetSize() int
GetSize returns the total number of elements in the disjoint set
func (*DisjointSet) Union ¶
func (ds *DisjointSet) Union(x, y int) bool
Union merges the sets containing elements x and y Uses union by rank for optimization
type LRUCache ¶
type LRUCache struct {
// contains filtered or unexported fields
}
LRUCache represents the LRU cache data structure
func NewLRUCache ¶
NewLRUCache creates a new LRU cache with the given capacity
func (*LRUCache) GetCapacity ¶
GetCapacity returns the capacity of the cache
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node represents a node in the doubly linked list
type SkipList ¶
type SkipList struct {
// contains filtered or unexported fields
}
SkipList represents the skip list data structure
type SkipListNode ¶
type SkipListNode struct {
// contains filtered or unexported fields
}
SkipListNode represents a node in the skip list