Package Struct
package Struct
The
Struct
package is a versatile collection of data structures designed for
competitive programming. It includes advanced structures that are highly optimized
to tackle complex problems, as well as classes meant for conveniently managing data.
Included Data Structures:
BSTNode
- Represents a node in a Binary Search Tree (BST).DSU
- Implements a Disjoint Set Union (also known as Union-Find), useful for keeping track of a partition of a set into disjoint subsets.ListNode
- Defines a node for a doubly linked list, commonly used in various list operations.SegTree
- Implements a Segment Tree, a data structure for efficient query and update operations on array intervals.Trie
- Implements a Trie (or prefix tree), which is an ordered tree data structure used for efficient String lookupSingle
- Encapsulates a single value within an object, sometimes useful for passing mutable values to methods or storing in collections.Pair
- Generic class for a tuple of two items, often used to store two related objects together without creating a specific class.Triple
- Generalizes Pair to include three related elements, allowing the association of three objects.Quad
- Extends the concept of Pair to include four related elements, useful for complex state or result capturing.
Use these data structures to increase the efficiency and readability of your competitive programming solutions.
- Since:
- 1.0
- Version:
- 1.0
- Author:
- Sahasrad Chippa
-
ClassesClassDescriptionBSTNode<T extends Comparable<T>>Represents a node in a binary search tree (BST) for elements of a comparable type.Represents a Disjoint Set Union (DSU) also known as Union-Find data structure.ListNode<T>Represents a node in a doubly linked list, which can be navigated in both directions: forward and backward.Pair<A,
B> ThePair
class stores two related objects of potentially different types.Quad<A,B, C, D> TheQuad
class stores four related objects of potentially different types.SegTree<T,R> A generic segment tree implementation that provides efficient range query and point update operations.Single<A>ASingle
is designed to hold an object of a generic typeA
.A Trie (or Prefix Tree) data structure implementation that supports efficient insertion and search operations for strings.Triple<A,B, C> TheTriple
class stores three related objects of potentially different types.