Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/TheAlgorithms/Java
/ functions
Functions
8,444 in github.com/TheAlgorithms/Java
⨍
Functions
8,444
◇
Types & classes
1,826
↓ 28 callers
Method
toUpperCase
Converts all the characters in this {@code String} to upper case. @param s the string to convert @return the {@code String}, converted to uppercase.
src/main/java/com/thealgorithms/strings/Upper.java:23
↓ 27 callers
Method
count
Counts the number of disjoint sets. @return the number of disjoint sets
src/main/java/com/thealgorithms/searches/UnionFind.java:89
↓ 27 callers
Method
defaultTTL
Sets the default time-to-live (TTL) in milliseconds for cache entries. @param ttlMillis the TTL duration in milliseconds; must be >= 0 @return this b
src/main/java/com/thealgorithms/datastructures/caches/RRCache.java:443
↓ 27 callers
Method
equals
(Object obj)
src/main/java/com/thealgorithms/compression/BurrowsWheelerTransform.java:83
↓ 27 callers
Method
findIntersections
Finds all intersection points among a set of line segments. <p>An intersection point is reported when two or more segments cross or touch. For overla
src/main/java/com/thealgorithms/geometry/BentleyOttmann.java:162
↓ 27 callers
Method
findSet
Finds and returns the representative (root) of the set containing the given node. This method applies path compression to flatten the tree structure f
src/main/java/com/thealgorithms/datastructures/disjointsetunion/DisjointSetUnionBySize.java:50
↓ 27 callers
Method
insertKey2HashTable
Inserts a key into the hash table using cuckoo hashing. If the target bucket is occupied, it relocates the existing key and attempts to insert it into
src/main/java/com/thealgorithms/datastructures/hashmap/hashing/HashMapCuckooHashing.java:73
↓ 26 callers
Method
isEmpty
Checks if the linked list is empty. @return true if the linked list is empty, false otherwise
src/main/java/com/thealgorithms/datastructures/hashmap/hashing/HashMap.java:232
↓ 26 callers
Method
unionSets
Merges the sets containing the two given nodes. Union by rank is used to attach the smaller tree under the larger one. If both sets have the same rank
src/main/java/com/thealgorithms/datastructures/disjointsetunion/DisjointSetUnion.java:47
↓ 25 callers
Method
add
Adds the specified element to the set. @param element the element to add
src/main/java/com/thealgorithms/datastructures/crdt/ORSet.java:63
↓ 25 callers
Method
buildLocation
(double x, double y)
src/main/java/com/thealgorithms/divideandconquer/ClosestPair.java:69
↓ 25 callers
Method
containsPoint
(Set<Point2D.Double> points, double x, double y)
src/test/java/com/thealgorithms/geometry/BentleyOttmannTest.java:321
↓ 25 callers
Method
decompress
Decompresses a list of LZ78 tokens back into the original string. @param compressedData The list of {@link Token} objects. Must not be null. @return
src/main/java/com/thealgorithms/compression/LZ78.java:113
↓ 25 callers
Method
empty
()
src/main/java/com/thealgorithms/datastructures/heaps/FibonacciHeap.java:62
↓ 25 callers
Method
getElement
@return the top element in the heap, the one with lowest key for min-heap or with the highest key for max-heap @throws EmptyHeapException if heap is e
src/main/java/com/thealgorithms/datastructures/heaps/Heap.java:27
↓ 25 callers
Method
getTurnAroundTimeTime
()
src/main/java/com/thealgorithms/devutils/entities/ProcessDetails.java:40
↓ 25 callers
Method
herons
Calculates the area of a triangle using Heron's Formula. <p> Given three side lengths a, b, and c, the area is computed as: Area = √(s(s - a)(s - b)(s
src/main/java/com/thealgorithms/maths/HeronsFormula.java:68
↓ 25 callers
Method
minSquares
Find minimum number of perfect squares that sum to n @param n the target number @return minimum number of squares needed
src/main/java/com/thealgorithms/maths/SumOfSquares.java:22
↓ 24 callers
Method
compress
Compresses the input text using the LZ78 algorithm. @param text The input string to compress. Must not be null. @return A list of {@link Token} objec
src/main/java/com/thealgorithms/compression/LZ78.java:68
↓ 24 callers
Method
compress
Compresses the input text using the LZ77 algorithm. @param text The input string to compress. Must not be null. @param windowSize The size of the sli
src/main/java/com/thealgorithms/compression/LZ77.java:54
↓ 24 callers
Method
equals
@param o : an object to compare with the current element @return true if the keys on both elements are identical and the additional info objects are i
src/main/java/com/thealgorithms/datastructures/heaps/HeapElement.java:150
↓ 24 callers
Method
format
(String format)
src/main/java/com/thealgorithms/maths/MathBuilder.java:483
↓ 24 callers
Method
insert
Creates a node (of type HeapNode) which contains the given key, and inserts it into the heap. @pre key>=0 @post (numOfnodes = = $prev numOfnodes + 1)
src/main/java/com/thealgorithms/datastructures/heaps/FibonacciHeap.java:74
↓ 24 callers
Method
isKaprekarNumber
Checks whether a given number is a Kaprekar number. <p> The algorithm works as follows: <ol> <li>Square the number</li> <li>Split the squared number i
src/main/java/com/thealgorithms/maths/KaprekarNumbers.java:79
↓ 24 callers
Method
median
Calculates the median of an array of integers. The array is sorted internally, so the original order is not preserved. For arrays with an odd number o
src/main/java/com/thealgorithms/maths/Median.java:36
↓ 24 callers
Method
multiply
Multiply a point by a scalar (repeated addition).
src/main/java/com/thealgorithms/ciphers/ECC.java:221
↓ 24 callers
Method
toString
()
src/main/java/com/thealgorithms/searches/UnionFind.java:100
↓ 23 callers
Method
apply
(int[] array)
src/test/java/com/thealgorithms/dynamicprogramming/LongestIncreasingSubsequenceTests.java:15
↓ 23 callers
Method
get
Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key. @param key the key whose associated valu
src/main/java/com/thealgorithms/datastructures/hashmap/hashing/GenericHashMapUsingArray.java:145
↓ 23 callers
Method
getKey
Returns the key value of the element. @return the key of the element
src/main/java/com/thealgorithms/datastructures/heaps/HeapElement.java:130
↓ 23 callers
Method
getProcessId
()
src/main/java/com/thealgorithms/scheduling/EDFScheduling.java:71
↓ 23 callers
Method
getX
()
src/main/java/com/thealgorithms/ciphers/ECC.java:171
↓ 23 callers
Method
insert
Inserts an element in it's appropriate place @param value Value to be inserted
src/main/java/com/thealgorithms/datastructures/queues/PriorityQueues.java:111
↓ 23 callers
Method
isSorted
Checks whether the array is sorted in ascending order. @param array the array to check @return true if the array is sorted in ascending order, false
src/main/java/com/thealgorithms/sorts/SortUtils.java:98
↓ 23 callers
Method
makeSet
Creates a new disjoint set containing the single specified element. @param value the element to be placed in a new singleton set @return a node repres
src/main/java/com/thealgorithms/datastructures/disjointsetunion/DisjointSetUnionBySize.java:40
↓ 23 callers
Method
max
Finds the maximum element in the given array. @param <T> the type of elements in the array, which must implement the Comparable interface @param arra
src/main/java/com/thealgorithms/sorts/BitonicSort.java:109
↓ 23 callers
Method
peekFront
Checks the element at the front of the queue without removing it. @return Element at the front of the queue. @throws IllegalStateException if the que
src/main/java/com/thealgorithms/datastructures/queues/Queue.java:84
↓ 22 callers
Method
addEdge
Adds an edge to the graph. @param graph the adjacency list representing the graph @param from the source vertex of the edge @param to the destination
src/main/java/com/thealgorithms/datastructures/graphs/Kruskal.java:49
↓ 22 callers
Method
getBurstTime
()
src/main/java/com/thealgorithms/scheduling/EDFScheduling.java:75
↓ 22 callers
Method
getY
()
src/main/java/com/thealgorithms/ciphers/ECC.java:175
↓ 22 callers
Method
next
Returns the next element in the iteration. @return the next element in the bag @throws NoSuchElementException if there are no more elements to return
src/main/java/com/thealgorithms/datastructures/bags/Bag.java:128
↓ 22 callers
Method
scheduleNext
Schedules the next task based on the priority and wait time. The priority of a task increases with the time it spends waiting. @return name of the ne
src/main/java/com/thealgorithms/scheduling/AgingScheduling.java:52
↓ 22 callers
Method
shortestCoprimeSegment
@param arr is the input array @return shortest segment in the array which has gcd equal to 1. If no such segment exists or array is empty, returns emp
src/main/java/com/thealgorithms/slidingwindow/ShortestCoprimeSegment.java:36
↓ 21 callers
Method
allowRequest
Attempts to allow a request based on the available tokens. If a token is available, it decrements the token count and allows the request. Otherwise, t
src/main/java/com/thealgorithms/datastructures/queues/TokenBucket.java:41
↓ 21 callers
Method
compare
()
src/test/java/com/thealgorithms/datastructures/crdt/GCounterTest.java:39
↓ 21 callers
Method
divideMessageWithP
The most significant part of the CRC algorithm. The message is divided by P, so the dividedMessage ArrayList<Integer> is created. If check == true, th
src/main/java/com/thealgorithms/others/CRCAlgorithm.java:130
↓ 21 callers
Method
fitProcess
Method to allocate memory to blocks according to the first fit algorithm. It should return an ArrayList of Integers, where the index is the process ID
src/main/java/com/thealgorithms/others/MemoryManagementAlgorithms.java:268
↓ 21 callers
Method
getEvictionStrategy
Returns the current {@link EvictionStrategy} used by this cache instance. @return the eviction strategy currently assigned to this cache
src/main/java/com/thealgorithms/datastructures/caches/RRCache.java:310
↓ 21 callers
Method
iterator
Returns an iterator over the elements in this bag. <p>The iterator provides a way to traverse the elements in the order they were added. @return an
src/main/java/com/thealgorithms/datastructures/bags/Bag.java:93
↓ 21 callers
Method
rotateLeft
Performs a circular left rotation (left shift) on a 32-bit integer. Bits shifted out from the left side are inserted on the right side. @param value
src/main/java/com/thealgorithms/bitmanipulation/BitRotate.java:38
↓ 21 callers
Method
setScores
Sets the scores array for the game tree. @param scores The array of scores. Length must be a power of 2. @throws IllegalArgumentException if the scor
src/main/java/com/thealgorithms/others/MiniMaxAlgorithm.java:180
↓ 21 callers
Method
twosComplement
Computes the Two's Complement of the given binary string. Steps: 1. Compute the One's Complement (invert all bits). 2. Add 1 to the One's Complement t
src/main/java/com/thealgorithms/bitmanipulation/TwosComplement.java:34
↓ 20 callers
Method
decompress
Decompresses a list of LZ77 tokens back into the original string. @param compressedData The list of {@link Token} objects. Must not be null. @return
src/main/java/com/thealgorithms/compression/LZ77.java:142
↓ 20 callers
Method
findHighestSetBit
Finds the highest (most significant) set bit in the given integer. The method returns the position (index) of the highest set bit as an {@link Optiona
src/main/java/com/thealgorithms/bitmanipulation/HighestSetBit.java:37
↓ 20 callers
Method
insert
Inserts a new element into the Leftist Heap. @param a the element to be inserted
src/main/java/com/thealgorithms/datastructures/heaps/LeftistHeap.java:120
↓ 20 callers
Method
mod
(double num)
src/main/java/com/thealgorithms/maths/MathBuilder.java:221
↓ 20 callers
Method
put
Associates the specified value with the specified key in this map. If the map previously contained a mapping for the key, the old value is replaced.
src/main/java/com/thealgorithms/datastructures/hashmap/hashing/GenericHashMapUsingArrayList.java:49
↓ 20 callers
Method
search
(T[][] matrix, T target)
src/main/java/com/thealgorithms/searches/RowColumnWiseSorted2dArrayBinarySearch.java:30
↓ 19 callers
Method
addLast
Adds the specified value to the tail of the deque @param val Value to add to the deque
src/main/java/com/thealgorithms/datastructures/queues/Deque.java:58
↓ 19 callers
Method
calculatePageRank
Calculates PageRank using the default damping factor and iterations @param totalNodes the total number of nodes @return array of PageRank values
src/main/java/com/thealgorithms/others/PageRank.java:141
↓ 19 callers
Method
compareTo
(Person o)
src/test/java/com/thealgorithms/sorts/SlowSortTest.java:125
↓ 19 callers
Method
gcd
Computes GCD of two long values using Stein's algorithm (binary GCD). <p>Handles negative inputs. If either input is {@code Long.MIN_VALUE} the method
src/main/java/com/thealgorithms/bitmanipulation/BitwiseGCD.java:41
↓ 19 callers
Method
get
Retrieves the value associated with the specified key. @param key the key whose associated value is to be returned @return the value associated with
src/main/java/com/thealgorithms/datastructures/caches/MRUCache.java:95
↓ 19 callers
Method
insert
Insert a key into the SplayTree. @param key The key to insert.
src/main/java/com/thealgorithms/datastructures/trees/SplayTree.java:48
↓ 19 callers
Method
lucasSeries
Calculate the nth Lucas number using recursion. Time Complexity: O(2^n) - exponential due to recursive calls Space Complexity: O(n) - recursion depth
src/main/java/com/thealgorithms/maths/LucasSeries.java:27
↓ 19 callers
Method
lucasSeriesIteration
Calculate the nth Lucas number using iteration. Time Complexity: O(n) - single loop through n iterations Space Complexity: O(1) - constant space usage
src/main/java/com/thealgorithms/maths/LucasSeries.java:49
↓ 19 callers
Method
reverse
Reverse character array @param values character array @param from begin index of given array @param to end index of given array
src/main/java/com/thealgorithms/strings/Rotation.java:53
↓ 18 callers
Method
addClause
Adds a clause of the form (a ∨ b) to the boolean expression. <p> Example: To add (¬x₁ ∨ x₂), call: </p> <pre>{@code addClause(1, true, 2, false); }<
src/main/java/com/thealgorithms/datastructures/graphs/TwoSat.java:127
↓ 18 callers
Method
addEdge
Adds a directed edge from one vertex to another in the adjacency list. If the vertex does not exist, it will be added to the list. @param from the st
src/main/java/com/thealgorithms/datastructures/graphs/KahnsAlgorithm.java:36
↓ 18 callers
Method
compareTo
(Node other)
src/main/java/com/thealgorithms/datastructures/graphs/DijkstraAlgorithm.java:31
↓ 18 callers
Method
containsKey
Returns true if this map contains a mapping for the specified key. @param key the key whose presence in this map is to be tested @return true if this
src/main/java/com/thealgorithms/datastructures/hashmap/hashing/GenericHashMapUsingArray.java:182
↓ 18 callers
Method
convertToInt
(double input)
src/main/java/com/thealgorithms/conversions/RgbHsvConversion.java:165
↓ 18 callers
Method
cos
()
src/main/java/com/thealgorithms/maths/MathBuilder.java:333
↓ 18 callers
Method
decode
Decodes the given Base64 encoded string to a byte array. @param input the Base64 encoded string to decode @return the decoded byte array @throws Ille
src/main/java/com/thealgorithms/conversions/Base64.java:106
↓ 18 callers
Method
equals
(Object obj)
src/main/java/com/thealgorithms/maths/LinearDiophantineEquationsSolver.java:187
↓ 18 callers
Method
equals
(Object obj)
src/main/java/com/thealgorithms/datastructures/trees/KDTree.java:85
↓ 18 callers
Method
evictionStrategy
Sets the eviction strategy used to determine when to clean up expired entries. @param strategy an {@link EvictionStrategy} implementation; must not b
src/main/java/com/thealgorithms/datastructures/caches/RRCache.java:497
↓ 18 callers
Method
find
Performs sentinel linear search on the given array. @param array the array to search in @param key the element to search for @param <T> the type of e
src/main/java/com/thealgorithms/searches/SentinelLinearSearch.java:46
↓ 18 callers
Method
gcd
get the greatest common divisor @param num1 the first number @param num2 the second number @return gcd
src/main/java/com/thealgorithms/maths/GCD.java:34
↓ 18 callers
Method
getCoordinate
(int i)
src/main/java/com/thealgorithms/datastructures/trees/KDTree.java:73
↓ 18 callers
Method
getEdgeArray
()
src/main/java/com/thealgorithms/datastructures/graphs/BellmanFord.java:181
↓ 18 callers
Method
integerToEnglishWords
Converts a non-negative integer to its English word representation. @param number the integer to convert (0-2,147,483,647) @return the English word r
src/main/java/com/thealgorithms/conversions/IntegerToEnglish.java:78
↓ 18 callers
Method
isPrime
Checks if a number is prime or not @param n the number @return {@code true} if {@code n} is prime
src/main/java/com/thealgorithms/maths/Prime/PrimeCheck.java:35
↓ 18 callers
Method
lookup
Checks if the given element is present in the G-Set. @param e the element to be checked @return true if the element is present, false otherwise
src/main/java/com/thealgorithms/datastructures/crdt/GSet.java:42
↓ 18 callers
Method
onAccess
Called on each cache access (e.g., {@link RRCache#get(Object)}) to optionally trigger eviction. @param cache the cache instance on which this strateg
src/main/java/com/thealgorithms/datastructures/caches/RRCache.java:356
↓ 18 callers
Method
pollFirst
Removes and returns the first (head) value in the deque @return the value of the head of the deque @throws NoSuchElementException if the deque is emp
src/main/java/com/thealgorithms/datastructures/queues/Deque.java:77
↓ 18 callers
Method
rank
How many times does the number x appear in the array from index 0 to i (inclusive)? @param x the number to search for @param i the end index (0-based
src/main/java/com/thealgorithms/datastructures/trees/WaveletTree.java:112
↓ 18 callers
Method
sin
()
src/main/java/com/thealgorithms/maths/MathBuilder.java:324
↓ 18 callers
Method
size
Returns the number of key-value pairs in this map. @return the number of key-value pairs
src/main/java/com/thealgorithms/datastructures/hashmap/hashing/GenericHashMapUsingArray.java:135
↓ 18 callers
Method
solve
Solves the linear system Ax = b using the Chebyshev iteration method. <p> NOTE: The matrix A must be symmetric positive-definite (SPD) for this algor
src/main/java/com/thealgorithms/maths/ChebyshevIteration.java:46
↓ 17 callers
Method
add
add in BST. if the value is not already present it is inserted or else no change takes place. @param data the value to be inserted
src/main/java/com/thealgorithms/datastructures/trees/BSTRecursiveGeneric.java:284
↓ 17 callers
Method
compareTo
(Symbol other)
src/main/java/com/thealgorithms/compression/ShannonFano.java:61
↓ 17 callers
Method
deQueue
Removes and returns the element at the front of the queue. @return the element at the front of the queue @throws IllegalStateException if the queue i
src/main/java/com/thealgorithms/datastructures/queues/CircularQueue.java:92
↓ 17 callers
Method
extractMin
Extracts and removes the minimum element from the heap. @return the minimum element in the heap, or -1 if the heap is empty
src/main/java/com/thealgorithms/datastructures/heaps/LeftistHeap.java:129
↓ 17 callers
Method
getHead
Get head of the list. @return head of the list.
src/main/java/com/thealgorithms/datastructures/lists/SinglyLinkedList.java:201
↓ 17 callers
Method
getValue
()
src/main/java/com/thealgorithms/datastructures/caches/MRUCache.java:222
↓ 17 callers
Method
greater
Compares two elements to see if the first is greater than the second. @param firstElement the first element to compare @param secondElement the seco
src/main/java/com/thealgorithms/sorts/SortUtils.java:45
↓ 17 callers
Method
insert
Inserts a new key into the min-priority queue. @param key the value to be inserted
src/main/java/com/thealgorithms/datastructures/heaps/MinPriorityQueue.java:44
↓ 17 callers
Method
isEmpty
Returns true if the queue is empty @return true if the queue is empty
src/main/java/com/thealgorithms/datastructures/queues/PriorityQueues.java:158
↓ 17 callers
Method
join
(int[][] c, int[][] p, int iB, int jB)
src/main/java/com/thealgorithms/divideandconquer/StrassenMatrixMultiplication.java:135
← previous
next →
101–200 of 8,444, ranked by callers