Index
All Classes and Interfaces|All Packages
A
- a - Variable in class Struct.Pair
-
The value stored as the first element.
- a - Variable in class Struct.Quad
-
The value stored as the first element.
- a - Variable in class Struct.Single
-
The value stored in this
Single
container. - a - Variable in class Struct.Triple
-
The value stored as the first element.
- accumulateInOrder(R, Function<BSTNode<T>, R>, BiFunction<R, R, R>) - Method in class Struct.BSTNode
-
Aggregates results across the BST nodes using an inorder traversal.
- accumulatePostOrder(R, Function<BSTNode<T>, R>, BiFunction<R, R, R>) - Method in class Struct.BSTNode
-
Aggregates results across the BST nodes using a postorder traversal.
- accumulatePreOrder(R, Function<BSTNode<T>, R>, BiFunction<R, R, R>) - Method in class Struct.BSTNode
-
Aggregates results across the BST nodes using a preorder traversal.
- add(BSTNode<T>) - Method in class Struct.BSTNode
-
Adds a node to the correct position in the subtree.
- Algo - Class in Util
-
Provides static methods for efficient algorithmic operations like binary search and ternary search on arrays and lists.
- Algo() - Constructor for class Util.Algo
B
- b - Variable in class Struct.Pair
-
The value stored as the second element.
- b - Variable in class Struct.Quad
-
The value stored as the second element.
- b - Variable in class Struct.Triple
-
The value stored as the second element.
- backwardString() - Method in class Struct.ListNode
-
Creates a string representation of all values from this node backwards until the list start.
- box(boolean[]) - Static method in class Util.Data
-
Converts an array of primitive booleans to an array of Boolean objects.
- box(char[]) - Static method in class Util.Data
-
Converts an array of primitive chars to an array of Character objects.
- box(double[]) - Static method in class Util.Data
-
Converts an array of primitive doubles to an array of Double objects.
- box(int[]) - Static method in class Util.Data
-
Converts an array of primitive ints to an array of Integer objects.
- box(long[]) - Static method in class Util.Data
-
Converts an array of primitive longs to an array of Long objects.
- BSTNode<T> - Class in Struct
-
Represents a node in a binary search tree (BST) for elements of a comparable type.
- BSTNode(T) - Constructor for class Struct.BSTNode
-
Initializes a BST node with the specified value.
C
- c - Variable in class Struct.Quad
-
The value stored as the third element.
- c - Variable in class Struct.Triple
-
The value stored as the third element.
- Calc - Class in Util
-
The Calc class provides a series of static methods for performing various mathematical computations like modular inverses, exponentiation, factorial, combinations, greatest common divisor (GCD), least common multiple (LCM), and Euler's Totient function.
- Calc() - Constructor for class Util.Calc
- choose(int, int) - Static method in class Util.Calc
-
Computes n choose k (combinatorics: combinations of n items taken k at a time).
- choose(int, int, long) - Static method in class Util.Calc
-
Computes n choose k under a specific modulus.
- connected(int, int) - Method in class Struct.DSU
-
Checks if the elements 'x' and 'y' are in the same set.
- Constants - Class in Util
-
Constants provides a central location to keep commonly used constants and configurations in competitive programming.
- Constants() - Constructor for class Util.Constants
- contains(CharSequence) - Method in class Struct.Trie
-
Checks if a word is in the Trie.
- convexMax(double, double, Function<Double, U>, boolean) - Static method in class Util.Algo
-
Performs a ternary search on a double range to find a local maximum point in a convex or unimodal function.
- convexMax(int, int, Function<Integer, U>) - Static method in class Util.Algo
-
Performs a ternary search on an integer range to find a local maximum point in a convex or unimodal function.
- convexMax(long, long, Function<Long, U>, long) - Static method in class Util.Algo
-
Performs a ternary search on a long range to find a local maximum point in a convex or unimodal function.
- convexMin(double, double, Function<Double, U>, boolean) - Static method in class Util.Algo
-
Performs a ternary search on a double range to find a local minimum point in a convex or unimodal function.
- convexMin(int, int, Function<Integer, U>) - Static method in class Util.Algo
-
Performs a ternary search on an integer range to find a local minimum point in a convex or unimodal function.
- convexMin(long, long, Function<Long, U>, long) - Static method in class Util.Algo
-
Performs a ternary search on a long range to find a local minimum point in a convex or unimodal function.
D
- d - Variable in class Struct.Quad
-
The value stored as the fourth element.
- Data - Class in Util
-
Provides utility methods for data manipulation, including finding minimum and maximum values, calculating prefix and suffix sums, and performing binary search operations on arrays and lists.
- Data() - Constructor for class Util.Data
- debug - Static variable in class Util.Constants
-
A debug flag that checks whether the application is running in a competitive programming environment (like Codeforces or AtCoder).
- dir2 - Static variable in class Util.Constants
-
A two-dimensional array representing the four orthogonal directions on a two-dimensional grid.
- dir3 - Static variable in class Util.Constants
-
A three-dimensional array representing the six principal direction vectors in a three-dimensional space.
- DSU - Class in Struct
-
Represents a Disjoint Set Union (DSU) also known as Union-Find data structure.
- DSU(int) - Constructor for class Struct.DSU
-
Initializes the DSU with n elements, each element is its own set initially.
E
- executeInOrder(Consumer<BSTNode<T>>) - Method in class Struct.BSTNode
-
Executes a consumer function on each node in the BST following an inorder traversal.
- executePostOrder(Consumer<BSTNode<T>>) - Method in class Struct.BSTNode
-
Executes a consumer function on each node in the BST following a postorder traversal.
- executePreOrder(Consumer<BSTNode<T>>) - Method in class Struct.BSTNode
-
Executes a consumer function on each node in the BST following a preorder traversal.
- exp(long, long, long) - Static method in class Util.Calc
-
Performs modular exponentiation efficiently using the right-to-left binary method.
F
- fact(int) - Static method in class Util.Calc
-
Computes the factorial of a number This version does not utilize modulus.
- fact(int, long) - Static method in class Util.Calc
-
Computes the factorial of n using the given modulus.
- factorials(int) - Static method in class Util.Calc
-
Returns an array of computed factorial values up to the provided maximum.
- factorials(int, long) - Static method in class Util.Calc
-
Returns an array of computer factorial values up to the provided maximum using the given modulus.
- find(int) - Method in class Struct.DSU
-
Finds the representative of the set that x is a part of.
- flush() - Static method in class Util.Out
-
Flushes the
PrintWriter
, ensuring all output is written out immediately. - forwardString() - Method in class Struct.ListNode
-
Creates a string representation of all values from this node forwards until the list end.
- forwardString(String, String, String) - Method in class Struct.ListNode
-
Generates a string from this node values moving forward, formatted with specified delimiters.
- fullyConnected() - Method in class Struct.DSU
-
Checks if all elements are part of a single set.
G
- gcd(int, int) - Static method in class Util.Calc
-
Computes the greatest common divisor (GCD) of two integers using the Euclidean algorithm.
- gcd(long, long) - Static method in class Util.Calc
-
Computes the greatest common divisor (GCD) of two long integers using the Euclidean algorithm.
- getDelimiter() - Static method in class Util.In
-
Gets the current delimiter string used to parse tokens.
- getDelimiter() - Static method in class Util.Out
-
Gets the current delimiter used in output methods that handle iterables and arrays.
- getError() - Static method in class Util.Algo
-
Retrieves the current error tolerance for calculations involving double precision.
- getMax(double[]) - Static method in class Util.Data
-
Returns the maximum value from a double array.
- getMax(int[]) - Static method in class Util.Data
-
Returns the maximum value from an int array.
- getMax(long[]) - Static method in class Util.Data
-
Returns the maximum value from a long array.
- getMax(List<U>) - Static method in class Util.Data
-
Returns the maximum value from a list of comparable elements.
- getMax(U[]) - Static method in class Util.Data
-
Returns the maximum value from an array of comparable elements.
- getMin(double[]) - Static method in class Util.Data
-
Returns the minimum value from a double array.
- getMin(int[]) - Static method in class Util.Data
-
Returns the minimum value from an int array.
- getMin(long[]) - Static method in class Util.Data
-
Returns the minimum value from a long array.
- getMin(List<U>) - Static method in class Util.Data
-
Returns the minimum value from a list of comparable elements.
- getMin(U[]) - Static method in class Util.Data
-
Returns the minimum value from an array of comparable elements.
- getWriter() - Static method in class Util.Out
-
Retrieves the current writer object.
I
- In - Class in Util
-
This class provides methods for input operations from various sources such as system input, files, and streams, and supports the parsing of primitive types and strings, including array and list formats.
- In() - Constructor for class Util.In
- insert(CharSequence) - Method in class Struct.Trie
-
Inserts a word into the Trie.
- iterPrint(boolean[]) - Static method in class Util.Out
-
Iterative printing for boolean arrays, printing each element separated by the current delimiter (a space by default).
- iterPrint(char[]) - Static method in class Util.Out
-
Iterative printing for char arrays, printing each element separated by the current delimiter (a space by default).
- iterPrint(double[]) - Static method in class Util.Out
-
Iterative printing for double arrays, printing each element separated by the current delimiter (a space by default).
- iterPrint(int[]) - Static method in class Util.Out
-
Iterative printing for integer arrays, printing each element separated by the current delimiter (a space by default).
- iterPrint(long[]) - Static method in class Util.Out
-
Iterative printing for long arrays, printing each element separated by the current delimiter (a space by default).
- iterPrint(Iterable<T>) - Static method in class Util.Out
-
Prints each element of the given iterable to the output, separated by the current delimiter.
- iterPrint(T[]) - Static method in class Util.Out
-
Prints each element of an array to the output, separated by the current delimiter (a space by default).
L
- lcm(long, long) - Static method in class Util.Calc
-
Computes the least common multiple (LCM) of two long integers using the relation LCM(a, b) = (a * b) / GCD(a, b).
- left - Variable in class Struct.BSTNode
-
This node's left child node, or null if not present.
- ListNode<T> - Class in Struct
-
Represents a node in a doubly linked list, which can be navigated in both directions: forward and backward.
- lowerBound(char[], char) - Static method in class Util.Algo
-
Finds the index of the first element in a sorted array of characters that is not less than the target character.
- lowerBound(char[], char) - Static method in class Util.Data
-
Finds the index of the first element in a sorted array of characters that is not less than the target character.
- lowerBound(double[], double) - Static method in class Util.Algo
-
Finds the index of the first element in a sorted array of doubles that is not less than the target double.
- lowerBound(double[], double) - Static method in class Util.Data
-
Finds the index of the first element in a sorted array of doubles that is not less than the target double.
- lowerBound(int[], int) - Static method in class Util.Algo
-
Finds the index of the first element in a sorted array of integers that is not less than the target integer.
- lowerBound(int[], int) - Static method in class Util.Data
-
Finds the index of the first element in a sorted array of integers that is not less than the target integer.
- lowerBound(int, int, U, Function<Integer, U>) - Static method in class Util.Algo
-
Performs a parameterized binary search to find the smallest index where the target is not greater, comparing using a provided function.
- lowerBound(long[], long) - Static method in class Util.Algo
-
Finds the index of the first element in a sorted array of longs that is not less than the target long.
- lowerBound(long[], long) - Static method in class Util.Data
-
Finds the index of the first element in a sorted array of longs that is not less than the target long.
- lowerBound(long, long, U, Function<Long, U>, long) - Static method in class Util.Algo
-
Performs a parameterized binary search using long indices to find the smallest index where the target is not greater, comparing using a provided function.
- lowerBound(List<U>, U) - Static method in class Util.Algo
-
Finds the index of the first element in a sorted list of comparable elements that is not less than the target value using a lower bound binary search algorithm.
- lowerBound(List<U>, U) - Static method in class Util.Data
-
Finds the index of the first element in a sorted list of comparable elements that is not less than the target value using a lower bound binary search algorithm.
- lowerBound(U[], U) - Static method in class Util.Algo
-
Finds the index of the first element in a sorted array that is not less than the target value using a lower bound binary search algorithm.
- lowerBound(U[], U) - Static method in class Util.Data
-
Finds the index of the first element in a sorted array that is not less than the target value using a lower bound binary search algorithm.
M
- MOD - Static variable in class Util.Constants
-
The most common modulo value used in competitive programming.
- MOD2 - Static variable in class Util.Constants
-
Alternative modulo constant used in competitive programming.
- modInverse(long, long) - Static method in class Util.Calc
-
Computes the modular multiplicative inverse of a value under a given modulo using the extended Euclidean algorithm.
- modInverse2(long, long) - Static method in class Util.Calc
-
Computes the modular inverse using Fermat's Little Theorem, which requires the modulus to be prime.
N
- next() - Static method in class Util.In
-
Reads the next token from input.
- nextBigInteger() - Static method in class Util.In
-
Reads the next token and tries to parse it as a
BigInteger
. - nextBigIntegerArray(int) - Static method in class Util.In
-
Reads and returns an array of BigInteger values.
- nextBigIntegerList(int) - Static method in class Util.In
-
Reads and returns a list of BigInteger values from the input.
- nextBinaryString(char) - Static method in class Util.In
-
Reads the next token and interprets it as a binary string where each 'truth' character (typically '1') is true.
- nextBoolean() - Static method in class Util.In
-
Reads the next token and tries to parse it as a boolean.
- nextBooleanArray(int) - Static method in class Util.In
-
Reads and returns an array of boolean values interpreted from the input.
- nextBooleanList(int) - Static method in class Util.In
-
Reads and returns a list of boolean values interpreted from the input.
- nextDouble() - Static method in class Util.In
-
Reads the next token and tries to parse it as a double.
- nextDoubleArray(int) - Static method in class Util.In
-
Reads and returns an array of double values from the input.
- nextDoubleList(int) - Static method in class Util.In
-
Reads and returns a list of double values from the input.
- nextInt() - Static method in class Util.In
-
Reads the next token and tries to parse it as an int.
- nextIntArray(int) - Static method in class Util.In
-
Reads and returns an array of integers from the input.
- nextIntList(int) - Static method in class Util.In
-
Reads and returns a list of integers from the input.
- nextLine() - Static method in class Util.In
-
Reads until the end of the current line and returns all remaining tokens as a single string.
- nextLong() - Static method in class Util.In
-
Reads the next token and tries to parse it as a long.
- nextLongArray(int) - Static method in class Util.In
-
Reads and returns an array of long integers from the input.
- nextLongList(int) - Static method in class Util.In
-
Reads and returns a list of long integers from the input.
- nextStringArray(int) - Static method in class Util.In
-
Reads and returns an array of strings from the input.
- nextStringList(int) - Static method in class Util.In
-
Reads and returns a list of strings from the input.
O
- Out - Class in Util
-
This class serves as a utility for output operations, allowing for redirection of output streams, file output, custom delimiters, and built-in support for printing various data types, including arrays and collections.
- Out() - Constructor for class Util.Out
P
- Pair<A,
B> - Class in Struct -
The
Pair
class stores two related objects of potentially different types. - Pair() - Constructor for class Struct.Pair
-
Constructs a default
Pair
with both elements initialized tonull
. - Pair(A, B) - Constructor for class Struct.Pair
-
Constructs a
Pair
with specified elements. - phi(long) - Static method in class Util.Calc
-
Computes Euler's Totient function φ(n), which counts the number of integers up to n that are coprime to n.
- populateFact(int) - Static method in class Util.Calc
-
Populates the array of internal factorial values without considering modulus.
- populateFact(int, long) - Static method in class Util.Calc
-
Populates the internal array of factorial and inverse factorial values using a given modulus.
- prefSum(double[]) - Static method in class Util.Data
-
Calculates the prefix sum array for an array of doubles.
- prefSum(int[]) - Static method in class Util.Data
-
Calculates the prefix sum array for an array of integers.
- prefSum(long[]) - Static method in class Util.Data
-
Calculates the prefix sum array for an array of longs.
- prefSum(BigInteger[]) - Static method in class Util.Data
-
Calculates the prefix sum array for an array of BigIntegers.
- print(Object) - Static method in class Util.Out
-
Prints an object to the output.
- printf(String, Object...) - Static method in class Util.Out
-
Provides formatted printing using
String.format(java.lang.String, java.lang.Object...)
like syntax. - println() - Static method in class Util.Out
-
Outputs a new line character to the output stream.
- println(Object) - Static method in class Util.Out
-
Prints an object to the output followed by a newline.
Q
- Quad<A,
B, - Class in StructC, D> -
The
Quad
class stores four related objects of potentially different types. - Quad() - Constructor for class Struct.Quad
-
Constructs a default
Quad
with all elements initialized tonull
. - Quad(A, B, C, D) - Constructor for class Struct.Quad
-
Constructs a
Quad
with specified elements. - query(int, int) - Method in class Struct.SegTree
-
Queries the aggregate value over a range [l, r].
R
- right - Variable in class Struct.BSTNode
-
This node's right child node, or null if not present.
S
- SegTree<T,
R> - Class in Struct -
A generic segment tree implementation that provides efficient range query and point update operations.
- SegTree(List<T>, Function<T, R>, BiFunction<R, R, R>) - Constructor for class Struct.SegTree
-
Constructs a segment tree from a list.
- SegTree(T[], Function<T, R>, BiFunction<R, R, R>) - Constructor for class Struct.SegTree
-
Constructs a segment tree from an array.
- set(int, T) - Method in class Struct.SegTree
-
Updates the value at a specific index.
- setDelimiter(String) - Static method in class Util.In
-
Sets a new delimiter for tokenizing input strings.
- setDelimiter(String) - Static method in class Util.Out
-
Sets a new delimiter for output methods to use when handling iterables and arrays.
- setError(double) - Static method in class Util.Algo
-
Sets a new error tolerance for calculations involving double precision.
- setFileInput(String) - Static method in class Util.In
-
Sets the input source to a file via its filename.
- setInput(InputStream) - Static method in class Util.In
-
Sets the input source to a specific
InputStream
. - setOutput(OutputStream) - Static method in class Util.Out
-
Sets the current output stream to a new
OutputStream
. - setOutputFile(String) - Static method in class Util.Out
-
Sets the output to a file with the specified filename.
- setWriter(PrintWriter) - Static method in class Util.Out
-
Sets the
PrintWriter
to a specified writer, allowing redirection of the output. - Single<A> - Class in Struct
-
A
Single
is designed to hold an object of a generic typeA
. - Single() - Constructor for class Struct.Single
-
Constructs an empty
Single
instance withnull
as the value. - Single(A) - Constructor for class Struct.Single
-
Constructs a
Single
instance that wraps the provided object. - Struct - package Struct
-
The
Struct
package is a versatile collection of data structures designed for competitive programming. - suffixSum(double[]) - Static method in class Util.Data
-
Calculates the suffix sum for an array of doubles.
- suffixSum(int[]) - Static method in class Util.Data
-
Calculates the suffix sum for an array of integers.
- suffixSum(long[]) - Static method in class Util.Data
-
Calculates the suffix sum for an array of longs.
- suffixSum(BigInteger[]) - Static method in class Util.Data
-
Calculates the suffix sum for an array of BigIntegers.
T
- toInorderList() - Method in class Struct.BSTNode
-
Constructs a list of node values following inorder traversal of the BST.
- toPostorderList() - Method in class Struct.BSTNode
-
Constructs a list of node values following postorder traversal of the BST.
- toPreorderList() - Method in class Struct.BSTNode
-
Constructs a list of node values following preorder traversal of the BST.
- toString() - Method in class Struct.ListNode
-
Provides a string representation of this node showing connections to its previous and next node values.
- toString() - Method in class Struct.Pair
-
Returns a string representation of this pair using default delimiters.
- toString() - Method in class Struct.Quad
-
Returns a string representation using default delimiters.
- toString() - Method in class Struct.Single
-
Returns a string representation of the wrapped object, surrounded by
"<>"
. - toString() - Method in class Struct.Triple
-
Returns a string representation using default delimiters.
- toString(String, String) - Method in class Struct.Single
-
Returns a string representation of the wrapped object, using custom specified prefix and suffix.
- toString(String, String, String) - Method in class Struct.Pair
-
Returns a string representation of this pair using custom specified delimiters.
- toString(String, String, String) - Method in class Struct.Quad
-
Returns a string representation using custom specified delimiters.
- toString(String, String, String) - Method in class Struct.Triple
-
Returns a string representation using custom specified delimiters.
- Trie - Class in Struct
-
A Trie (or Prefix Tree) data structure implementation that supports efficient insertion and search operations for strings.
- Trie() - Constructor for class Struct.Trie
-
Constructs an empty Trie with default lowercase alphabet settings (a-z).
- Trie(char[]) - Constructor for class Struct.Trie
-
Constructs a Trie specifying allowed characters.
- Trie(List<Character>) - Constructor for class Struct.Trie
-
Constructs a Trie specifying allowed characters.
- Triple<A,
B, - Class in StructC> -
The
Triple
class stores three related objects of potentially different types. - Triple() - Constructor for class Struct.Triple
-
Constructs a default
Triple
with all elements initialized tonull
. - Triple(A, B, C) - Constructor for class Struct.Triple
-
Constructs a
Triple
with the specified elements.
U
- union(int, int) - Method in class Struct.DSU
-
Unites the set that includes 'x' with the set that includes 'y'.
- upperBound(char[], char) - Static method in class Util.Algo
-
Finds the index of the first element in the sorted array of characters that is greater than the target character.
- upperBound(char[], char) - Static method in class Util.Data
-
Finds the index of the first element in the sorted array of characters that is greater than the target character.
- upperBound(double[], double) - Static method in class Util.Algo
-
Finds the index of the first element in the sorted array of doubles that is greater than the target double.
- upperBound(double[], double) - Static method in class Util.Data
-
Finds the index of the first element in the sorted array of doubles that is greater than the target double.
- upperBound(int[], int) - Static method in class Util.Algo
-
Finds the index of the first element in the sorted array of integers that is greater than the target integer.
- upperBound(int[], int) - Static method in class Util.Data
-
Finds the index of the first element in the sorted array of integers that is greater than the target integer.
- upperBound(int, int, U, Function<Integer, U>) - Static method in class Util.Algo
-
Finds the index of the first element greater than the target using a custom function mapping integers to comparable items.
- upperBound(long[], long) - Static method in class Util.Algo
-
Finds the index of the first element in the sorted array of longs that is greater than the target long.
- upperBound(long[], long) - Static method in class Util.Data
-
Finds the index of the first element in the sorted array of longs that is greater than the target long.
- upperBound(long, long, U, Function<Long, U>, long) - Static method in class Util.Algo
-
Performs a binary search to find the upper bound (index of first element greater than the target) in a wider range specified using long indices.
- upperBound(List<U>, U) - Static method in class Util.Algo
-
Finds the index of the first element in a sorted list that is greater than the target using an upper bound binary search algorithm.
- upperBound(List<U>, U) - Static method in class Util.Data
-
Finds the index of the first element in a sorted list that is greater than the target using an upper bound binary search algorithm.
- upperBound(U[], U) - Static method in class Util.Algo
-
Finds the index of the first element in a sorted array that is greater than the target using an upper bound binary search algorithm.
- upperBound(U[], U) - Static method in class Util.Data
-
Finds the index of the first element in a sorted array that is greater than the target using an upper bound binary search algorithm.
- Util - package Util
-
The
Util
package offers specialized classes for algorithmic operations data manipulation, mathematical computations, and standardized input/output handling.
V
- val - Variable in class Struct.BSTNode
-
This node's store value
All Classes and Interfaces|All Packages