MCPcopy Create free account

hub / github.com/TheAlgorithms/Java / functions

Functions8,444 in github.com/TheAlgorithms/Java

↓ 28 callersMethodtoUpperCase
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 callersMethodcount
Counts the number of disjoint sets. @return the number of disjoint sets
src/main/java/com/thealgorithms/searches/UnionFind.java:89
↓ 27 callersMethoddefaultTTL
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 callersMethodequals
(Object obj)
src/main/java/com/thealgorithms/compression/BurrowsWheelerTransform.java:83
↓ 27 callersMethodfindIntersections
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 callersMethodfindSet
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 callersMethodinsertKey2HashTable
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 callersMethodisEmpty
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 callersMethodunionSets
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 callersMethodadd
Adds the specified element to the set. @param element the element to add
src/main/java/com/thealgorithms/datastructures/crdt/ORSet.java:63
↓ 25 callersMethodbuildLocation
(double x, double y)
src/main/java/com/thealgorithms/divideandconquer/ClosestPair.java:69
↓ 25 callersMethodcontainsPoint
(Set<Point2D.Double> points, double x, double y)
src/test/java/com/thealgorithms/geometry/BentleyOttmannTest.java:321
↓ 25 callersMethoddecompress
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 callersMethodempty
()
src/main/java/com/thealgorithms/datastructures/heaps/FibonacciHeap.java:62
↓ 25 callersMethodgetElement
@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 callersMethodgetTurnAroundTimeTime
()
src/main/java/com/thealgorithms/devutils/entities/ProcessDetails.java:40
↓ 25 callersMethodherons
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 callersMethodminSquares
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 callersMethodcompress
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 callersMethodcompress
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 callersMethodequals
@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 callersMethodformat
(String format)
src/main/java/com/thealgorithms/maths/MathBuilder.java:483
↓ 24 callersMethodinsert
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 callersMethodisKaprekarNumber
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 callersMethodmedian
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 callersMethodmultiply
Multiply a point by a scalar (repeated addition).
src/main/java/com/thealgorithms/ciphers/ECC.java:221
↓ 24 callersMethodtoString
()
src/main/java/com/thealgorithms/searches/UnionFind.java:100
↓ 23 callersMethodapply
(int[] array)
src/test/java/com/thealgorithms/dynamicprogramming/LongestIncreasingSubsequenceTests.java:15
↓ 23 callersMethodget
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 callersMethodgetKey
Returns the key value of the element. @return the key of the element
src/main/java/com/thealgorithms/datastructures/heaps/HeapElement.java:130
↓ 23 callersMethodgetProcessId
()
src/main/java/com/thealgorithms/scheduling/EDFScheduling.java:71
↓ 23 callersMethodgetX
()
src/main/java/com/thealgorithms/ciphers/ECC.java:171
↓ 23 callersMethodinsert
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 callersMethodisSorted
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 callersMethodmakeSet
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 callersMethodmax
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 callersMethodpeekFront
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 callersMethodaddEdge
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 callersMethodgetBurstTime
()
src/main/java/com/thealgorithms/scheduling/EDFScheduling.java:75
↓ 22 callersMethodgetY
()
src/main/java/com/thealgorithms/ciphers/ECC.java:175
↓ 22 callersMethodnext
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 callersMethodscheduleNext
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 callersMethodshortestCoprimeSegment
@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 callersMethodallowRequest
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 callersMethodcompare
()
src/test/java/com/thealgorithms/datastructures/crdt/GCounterTest.java:39
↓ 21 callersMethoddivideMessageWithP
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 callersMethodfitProcess
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 callersMethodgetEvictionStrategy
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 callersMethoditerator
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 callersMethodrotateLeft
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 callersMethodsetScores
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 callersMethodtwosComplement
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 callersMethoddecompress
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 callersMethodfindHighestSetBit
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 callersMethodinsert
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 callersMethodmod
(double num)
src/main/java/com/thealgorithms/maths/MathBuilder.java:221
↓ 20 callersMethodput
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 callersMethodsearch
(T[][] matrix, T target)
src/main/java/com/thealgorithms/searches/RowColumnWiseSorted2dArrayBinarySearch.java:30
↓ 19 callersMethodaddLast
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 callersMethodcalculatePageRank
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 callersMethodcompareTo
(Person o)
src/test/java/com/thealgorithms/sorts/SlowSortTest.java:125
↓ 19 callersMethodgcd
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 callersMethodget
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 callersMethodinsert
Insert a key into the SplayTree. @param key The key to insert.
src/main/java/com/thealgorithms/datastructures/trees/SplayTree.java:48
↓ 19 callersMethodlucasSeries
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 callersMethodlucasSeriesIteration
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 callersMethodreverse
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 callersMethodaddClause
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 callersMethodaddEdge
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 callersMethodcompareTo
(Node other)
src/main/java/com/thealgorithms/datastructures/graphs/DijkstraAlgorithm.java:31
↓ 18 callersMethodcontainsKey
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 callersMethodconvertToInt
(double input)
src/main/java/com/thealgorithms/conversions/RgbHsvConversion.java:165
↓ 18 callersMethodcos
()
src/main/java/com/thealgorithms/maths/MathBuilder.java:333
↓ 18 callersMethoddecode
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 callersMethodequals
(Object obj)
src/main/java/com/thealgorithms/maths/LinearDiophantineEquationsSolver.java:187
↓ 18 callersMethodequals
(Object obj)
src/main/java/com/thealgorithms/datastructures/trees/KDTree.java:85
↓ 18 callersMethodevictionStrategy
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 callersMethodfind
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 callersMethodgcd
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 callersMethodgetCoordinate
(int i)
src/main/java/com/thealgorithms/datastructures/trees/KDTree.java:73
↓ 18 callersMethodgetEdgeArray
()
src/main/java/com/thealgorithms/datastructures/graphs/BellmanFord.java:181
↓ 18 callersMethodintegerToEnglishWords
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 callersMethodisPrime
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 callersMethodlookup
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 callersMethodonAccess
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 callersMethodpollFirst
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 callersMethodrank
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 callersMethodsin
()
src/main/java/com/thealgorithms/maths/MathBuilder.java:324
↓ 18 callersMethodsize
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 callersMethodsolve
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 callersMethodadd
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 callersMethodcompareTo
(Symbol other)
src/main/java/com/thealgorithms/compression/ShannonFano.java:61
↓ 17 callersMethoddeQueue
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 callersMethodextractMin
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 callersMethodgetHead
Get head of the list. @return head of the list.
src/main/java/com/thealgorithms/datastructures/lists/SinglyLinkedList.java:201
↓ 17 callersMethodgetValue
()
src/main/java/com/thealgorithms/datastructures/caches/MRUCache.java:222
↓ 17 callersMethodgreater
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 callersMethodinsert
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 callersMethodisEmpty
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 callersMethodjoin
(int[][] c, int[][] p, int iB, int jB)
src/main/java/com/thealgorithms/divideandconquer/StrassenMatrixMultiplication.java:135
← previousnext →101–200 of 8,444, ranked by callers