MCPcopy Create free account

hub / github.com/TheAlgorithms/Java / functions

Functions8,444 in github.com/TheAlgorithms/Java

↓ 6 callersMethodtransform
Performs the forward Burrows-Wheeler Transform on the input string. <p> The algorithm generates all cyclic rotations of the input, sorts them lexicogr
src/main/java/com/thealgorithms/compression/BurrowsWheelerTransform.java:124
↓ 6 callersMethodtwoSum
The function "twoSum" takes an array of integers and a target integer as input, and returns an array of two indices where the corresponding elements i
src/main/java/com/thealgorithms/misc/TwoSumProblem.java:20
↓ 6 callersMethodupdateRange
Update the value of given range with the given value diff in O(log n) time. @param left The left index of the range to update. @param right The right
src/main/java/com/thealgorithms/datastructures/trees/LazySegmentTree.java:129
↓ 6 callersMethodvelocityAddition
Calculates the velocity with respect to the moving frame. @param v1 The velocity of the object with respect to laboratory frame (m/s). @param v The v
src/main/java/com/thealgorithms/physics/Relativity.java:72
↓ 5 callersMethodadd
(final BigDecimal[][] matrix1, final BigDecimal[][] matrix2)
src/main/java/com/thealgorithms/matrix/utils/MatrixUtil.java:90
↓ 5 callersMethodaddAgent
(String agentName)
src/main/java/com/thealgorithms/scheduling/MultiAgentScheduling.java:43
↓ 5 callersMethodaddGang
(String gangName)
src/main/java/com/thealgorithms/scheduling/GangScheduling.java:43
↓ 5 callersMethodaddTaskToGang
(String gangName, String task)
src/main/java/com/thealgorithms/scheduling/GangScheduling.java:47
↓ 5 callersMethodassignTask
Assign a task to a specific agent. @param agentName the name of the agent @param task the task to be assigned
src/main/java/com/thealgorithms/scheduling/MultiAgentScheduling.java:53
↓ 5 callersMethodavailable
Number of bytes not yet been read
src/main/java/com/thealgorithms/io/BufferedReader.java:74
↓ 5 callersMethodbinomialCoefficient
This method returns the number of ways in which k objects can be chosen from n objects @param totalObjects Total number of objects @param numberOf
src/main/java/com/thealgorithms/maths/BinomialCoefficient.java:26
↓ 5 callersMethodbinsear
(T[] arr, int left, int right, T target)
src/main/java/com/thealgorithms/searches/RecursiveBinarySearch.java:25
↓ 5 callersMethodbitSwap
Swaps two bits at specified positions in an integer. @param data The input integer whose bits need to be swapped @param posA The position of the firs
src/main/java/com/thealgorithms/bitmanipulation/BitSwap.java:21
↓ 5 callersMethodcalculateForceVector
Calculates the electrostatic force vector exerted by one charge on another. The returned vector is the force on the second charge (q2). @param q1 Cha
src/main/java/com/thealgorithms/physics/CoulombsLaw.java:33
↓ 5 callersMethodcalculateJacobi
Computes the Jacobi symbol (a/n), which is a generalization of the Legendre symbol. @param a the numerator @param num the denominator (must be an odd
src/main/java/com/thealgorithms/maths/SolovayStrassenPrimalityTest.java:67
↓ 5 callersMethodcheck
Checks for extra or redundant brackets in a given expression. @param expression the string representing the expression to be checked @return true if
src/main/java/com/thealgorithms/stacks/DuplicateBrackets.java:20
↓ 5 callersMethodcheckInvalidRange
(int from, int to)
src/test/java/com/thealgorithms/maths/AmicableNumberTest.java:49
↓ 5 callersMethodcheckTableContainsKey
Checks if the given key is present in the hash table. @param key the key to be checked @return true if the key exists, false otherwise
src/main/java/com/thealgorithms/datastructures/hashmap/hashing/HashMapCuckooHashing.java:214
↓ 5 callersMethodclear
Removes all entries from the cache, regardless of their expiration status. <p>This method clears the internal cache map entirely, resets the hit-and-
src/main/java/com/thealgorithms/datastructures/caches/FIFOCache.java:323
↓ 5 callersMethodclearLowestSetBit
Clears the lowest set bit of the given number. For example, if n = 18 (binary: 10010), the result will be 16 (binary: 10000). @param n the number who
src/main/java/com/thealgorithms/bitmanipulation/LowestSetBit.java:30
↓ 5 callersMethodcombination
Find all combinations of given array using backtracking @param arr the array. @param n length of combination @param <T> the type of elements in the ar
src/main/java/com/thealgorithms/backtracking/Combination.java:23
↓ 5 callersMethodconvertMatchingToArray
Helper method to convert a list of matching pairs into a sorted 2D array. Sorting ensures consistent ordering of pairs and vertices for easier compari
src/test/java/com/thealgorithms/datastructures/graphs/EdmondsBlossomAlgorithmTest.java:29
↓ 5 callersMethodcorrelation
Discrete correlation function. Correlation between two discrete variables is calculated according to the formula: Cor(x, y)=Cov(x, y)/sqrt(Var(x) Var(
src/main/java/com/thealgorithms/maths/Correlation.java:24
↓ 5 callersMethodcountDistinct
Returns an array where each element is the count of distinct elements in the corresponding window of size k. @param arr the input array @param k th
src/main/java/com/thealgorithms/slidingwindow/CountDistinctElementsInWindow.java:24
↓ 5 callersMethodcreateLoop
Creates a loop in a linked list by connecting the next pointer of a node at a specified starting position (position2) to another node at a specified d
src/main/java/com/thealgorithms/datastructures/lists/CreateAndDetectLoop.java:42
↓ 5 callersMethoddelete
Deletes the key-value pair associated with the specified key from the hash map. @param key the key whose key-value pair is to be deleted
src/main/java/com/thealgorithms/datastructures/hashmap/hashing/HashMap.java:63
↓ 5 callersMethoddeleteMin
Delete the node containing the minimum key in the heap updates new min @post (numOfnodes = = $prev numOfnodes - 1)
src/main/java/com/thealgorithms/datastructures/heaps/FibonacciHeap.java:93
↓ 5 callersMethoddfsRecursiveOrder
DFS (recursive) that records the order of first visit starting at {@code start}, but only recurses to a child when <b>all</b> its predecessors have be
src/main/java/com/thealgorithms/graph/PredecessorConstrainedDfs.java:80
↓ 5 callersMethoddigitSeparationForwardOrder
Separates the digits of a large positive number into a list in forward order. @param largeNumber The large number to separate digits from. @return A l
src/main/java/com/thealgorithms/greedyalgorithms/DigitSeparation.java:35
↓ 5 callersMethodempty
Creates an empty ImmutableHashMap. @param <K> key type @param <V> value type @return empty ImmutableHashMap
src/main/java/com/thealgorithms/datastructures/hashmap/hashing/ImmutableHashMap.java:34
↓ 5 callersMethodencode
Encodes a given string into a zig-zag pattern. @param s the input string to be encoded @param numRows the number of rows in the zigzag pattern
src/main/java/com/thealgorithms/strings/zigZagPattern/ZigZagPattern.java:15
↓ 5 callersMethodencrypt
Encrypts a certain String with the Columnar Transposition Cipher Rule @param word Word being encrypted @param keyword String with keyword being used
src/main/java/com/thealgorithms/ciphers/ColumnarTranspositionCipher.java:30
↓ 5 callersMethodeulerFull
Loops through all the steps until xEnd is reached, adds a point for each step and then returns all the points @param xStart First x-value. @param xEn
src/main/java/com/thealgorithms/maths/EulerMethod.java:77
↓ 5 callersMethodevaluatePostfix
Evaluates the given postfix expression and returns the result. @param expression The postfix expression as a string with operands and operators separ
src/main/java/com/thealgorithms/stacks/PostfixEvaluator.java:27
↓ 5 callersMethodextendedGCD
This method implements the extended Euclidean algorithm. @param a The first number. @param b The second number. @return An array of three integers:
src/main/java/com/thealgorithms/maths/ExtendedEuclideanAlgorithm.java:30
↓ 5 callersMethodfactorial
(int n)
src/main/java/com/thealgorithms/maths/Factorial.java:9
↓ 5 callersMethodfind
Method to find a Node with a certain value @param key Value being looked for @return The node if it finds it, otherwise returns the parent
src/main/java/com/thealgorithms/datastructures/trees/BinaryTree.java:83
↓ 5 callersMethodgamma
Calculates the gamma parameter that is of paramount importance in relativity theory. It is a dimensionless parameter that is equal to 1 for zero veloc
src/main/java/com/thealgorithms/physics/Relativity.java:30
↓ 5 callersMethodgenerateArray
Function to generate array of double values, with predefined size. @param size result array size @return array of Double values, randomly generated,
src/main/java/com/thealgorithms/sorts/SortUtilsRandomGenerator.java:23
↓ 5 callersMethodgeneratePrimes
Generates a list of all prime numbers up to the specified limit using the Sieve of Atkin algorithm. @param limit the upper bound up to which primes a
src/main/java/com/thealgorithms/maths/SieveOfAtkin.java:27
↓ 5 callersMethodget
Returns the value to which the specified key is mapped, or null if this cache contains no mapping for the key. @param key the key whose associated va
src/main/java/com/thealgorithms/datastructures/caches/LRUCache.java:107
↓ 5 callersMethodgetAliquotSum
Function to calculate the aliquot sum of an integer number @param n a positive integer @return aliquot sum of given {@code number}
src/main/java/com/thealgorithms/maths/AliquotSum.java:36
↓ 5 callersMethodgetClockBit
()
src/main/java/com/thealgorithms/ciphers/a5/LFSR.java:40
↓ 5 callersMethodgetDistance
()
src/main/java/com/thealgorithms/datastructures/graphs/AStar.java:83
↓ 5 callersMethodgetHorizontalRange
@return The total horizontal distance traveled (meters).
src/main/java/com/thealgorithms/physics/ProjectileMotion.java:39
↓ 5 callersMethodgetMaxHeight
@return The maximum vertical height from the ground (meters).
src/main/java/com/thealgorithms/physics/ProjectileMotion.java:44
↓ 5 callersMethodgetMaxSumApproach1
Approach 1: Uses a dynamic programming array to store the maximum sum at each index. Time Complexity: O(n) - where n is the length of the input array.
src/main/java/com/thealgorithms/dynamicprogramming/MaximumSumOfNonAdjacentElements.java:21
↓ 5 callersMethodgetMaxSumApproach2
Approach 2: Optimized space complexity approach using two variables instead of an array. Time Complexity: O(n) - where n is the length of the input ar
src/main/java/com/thealgorithms/dynamicprogramming/MaximumSumOfNonAdjacentElements.java:60
↓ 5 callersMethodgetNth
Return element at special index. @param index given index of element @return element at special index.
src/main/java/com/thealgorithms/datastructures/lists/SinglyLinkedList.java:377
↓ 5 callersMethodgetNumVertices
Returns the number of vertices in the graph. @return the number of vertices
src/main/java/com/thealgorithms/datastructures/graphs/WelshPowell.java:97
↓ 5 callersMethodgetResult
Returns whether the number was found in the segment. @return true if the number was found, false otherwise
src/main/java/com/thealgorithms/searches/LinearSearchThread.java:71
↓ 5 callersMethodgetSecretEncryptionKey
gets the AES encryption key. In your actual programs, this should be safely stored. @return secKey (Secret key that we encrypt using it) @throws NoSu
src/main/java/com/thealgorithms/ciphers/AESEncryption.java:51
↓ 5 callersMethodgetTimeOfFlight
@return The total time the projectile is in the air (seconds).
src/main/java/com/thealgorithms/physics/ProjectileMotion.java:34
↓ 5 callersMethodgetWrongMessCaught
Returns the counter wrongMessCaught @return wrongMessCaught, the number of wrong messages, which are caught by the CRC algoriithm
src/main/java/com/thealgorithms/others/CRCAlgorithm.java:73
↓ 5 callersMethodgetWrongMessNotCaught
Returns the counter wrongMessNotCaught @return wrongMessNotCaught, the number of wrong messages, which are not caught by the CRC algorithm
src/main/java/com/thealgorithms/others/CRCAlgorithm.java:83
↓ 5 callersMethodhammingDistance
Calculates the Hamming distance between two integers. The Hamming distance is the number of differing bits between the two integers. @param x The fir
src/main/java/com/thealgorithms/bitmanipulation/HammingDistance.java:25
↓ 5 callersMethodhasEulerianCircuit
()
src/main/java/com/thealgorithms/graph/HierholzerAlgorithm.java:41
↓ 5 callersMethodhasNext
Checks if there are more elements to iterate over. @return {@code true} if there are more elements; {@code false} otherwise
src/main/java/com/thealgorithms/datastructures/bags/Bag.java:117
↓ 5 callersMethodincrement
(int i)
src/main/java/com/thealgorithms/datastructures/hashmap/hashing/LinearProbingHashMap.java:153
↓ 5 callersMethodinitialize
(BitSet sessionKey, BitSet frameCounter)
src/main/java/com/thealgorithms/ciphers/a5/BaseLFSR.java:6
↓ 5 callersMethodinorderSort
return a sorted list by traversing the tree elements using inorder traversal
src/main/java/com/thealgorithms/datastructures/trees/BSTRecursiveGeneric.java:310
↓ 5 callersMethodisAmicableNumber
Checks whether 2 numbers are AmicableNumbers or not.
src/main/java/com/thealgorithms/maths/AmicableNumber.java:52
↓ 5 callersMethodisBinaryPalindrome
Checks if the binary representation of a number is a palindrome. @param x The number to check. @return True if the binary representation is a palindr
src/main/java/com/thealgorithms/bitmanipulation/BinaryPalindromeCheck.java:29
↓ 5 callersMethodisBlank
Helper method to check if a color is unassigned @param color the color to check @return {@code true} if the color is unassigned, {@code false} otherw
src/main/java/com/thealgorithms/datastructures/graphs/WelshPowell.java:151
↓ 5 callersMethodisEmpty
Checks whether the stack is empty. @return {@code true} if the stack has no elements, {@code false} otherwise
src/main/java/com/thealgorithms/datastructures/stacks/NodeStack.java:86
↓ 5 callersMethodisEven
(int number)
src/main/java/com/thealgorithms/bitmanipulation/IsEven.java:11
↓ 5 callersMethodisFull
@brief Checks if the queue is full @return true if the queue has reached its capacity
src/main/java/com/thealgorithms/datastructures/queues/ThreadSafeQueue.java:170
↓ 5 callersMethodisSubsetSum
Determines whether there exists a subset of the given array that adds up to the specified sum. This method uses a space-optimized dynamic programming
src/main/java/com/thealgorithms/dynamicprogramming/SubsetSumSpaceOptimized.java:23
↓ 5 callersMethodjobSequencingWithDeadlines
Schedules jobs to maximize profit while respecting their deadlines and arrival times. This method sorts the jobs in descending order of profit and at
src/main/java/com/thealgorithms/scheduling/JobSchedulingWithDeadline.java:61
↓ 5 callersMethodjugglerSequence
This method prints juggler sequence starting with the number in the parameter @param inputNumber Number from which juggler sequence is to be started
src/main/java/com/thealgorithms/maths/JugglerSequence.java:23
↓ 5 callersMethodkShortestPaths
Compute up to k loopless shortest paths from src to dst using Yen's algorithm. @param weights adjacency matrix; weights[u][v] = -1 means no edge; oth
src/main/java/com/thealgorithms/graph/YensKShortestPaths.java:39
↓ 5 callersMethodkmpSearch
(String pat, String txt)
src/main/java/com/thealgorithms/searches/KMPSearch.java:5
↓ 5 callersMethodlengthOfLongestSubstring
This method finds the length of the longest substring without repeating characters. @param s is the input string @return the length of the longest su
src/main/java/com/thealgorithms/slidingwindow/LongestSubstringWithoutRepeatingCharacters.java:29
↓ 5 callersMethodliangBarskyClip
(Line line)
src/main/java/com/thealgorithms/lineclipping/LiangBarsky.java:39
↓ 5 callersMethodmaxSlidingWindow
Finds the maximum values in each sliding window of size k. @param nums The input array of integers @param windowSize The size of the sliding window @
src/main/java/com/thealgorithms/slidingwindow/MaximumSlidingWindow.java:26
↓ 5 callersMethodmaximumMatching
Finds the maximum matching in a general graph (Edmonds Blossom Algorithm). @param edges A list of edges in the graph. @param vertexCount The number o
src/main/java/com/thealgorithms/datastructures/graphs/EdmondsBlossomAlgorithm.java:33
↓ 5 callersMethodmemoizedMatrixChain
Calculates the minimum number of scalar multiplications needed to multiply a chain of matrices. @param p an array of integers representing the dimens
src/main/java/com/thealgorithms/dynamicprogramming/MatrixChainRecursiveTopDownMemoisation.java:29
↓ 5 callersMethodminTrials
(int n, int m)
src/main/java/com/thealgorithms/dynamicprogramming/EggDropping.java:11
↓ 5 callersMethodminimumCoins
This method finds the minimum number of coins needed for a given amount. @param coins The list of coins @param amount The amount for which we need to
src/main/java/com/thealgorithms/dynamicprogramming/CoinChange.java:38
↓ 5 callersMethodmodInverse
@brief Computes the modular inverse of a number with respect to a modulus using the Extended Euclidean Algorithm. @param a The number for which to fin
src/main/java/com/thealgorithms/maths/ChineseRemainderTheorem.java:55
↓ 5 callersMethodmultiply
(String num1, String num2)
src/main/java/com/thealgorithms/maths/ComplexNumberMultiply.java:23
↓ 5 callersMethodnegate
Returns the index representing the negation of the given variable. <p> Mapping rule: </p> <pre> For a variable i: negate(i) = i + n For a negate
src/main/java/com/thealgorithms/datastructures/graphs/TwoSat.java:262
↓ 5 callersMethodnextHigherPowerOfTwo
Finds the next higher power of two. @param x The given number. @return The next higher power of two.
src/main/java/com/thealgorithms/bitmanipulation/HigherLowerPowerOfTwo.java:29
↓ 5 callersMethodnextLowerPowerOfTwo
Finds the next lower power of two. @param x The given number. @return The next lower power of two.
src/main/java/com/thealgorithms/bitmanipulation/HigherLowerPowerOfTwo.java:48
↓ 5 callersMethodnumberOfVertices
Getter for `this.vertexCount` @return the number of vertices in the graph
src/main/java/com/thealgorithms/datastructures/graphs/MatrixGraphs.java:98
↓ 5 callersMethodnumberOfWays
Calculates the no. of distinct ways to climb a staircase with n steps. @param n the no. of steps in the staircase (non-negative integer) @return the
src/main/java/com/thealgorithms/dynamicprogramming/ClimbingStairs.java:34
↓ 5 callersMethodonSegment
(Segment s, Point2D.Double p)
src/main/java/com/thealgorithms/geometry/BentleyOttmann.java:416
↓ 5 callersMethodpeek
Returns the element at the front of the queue without removing it. @return the element at the front of the queue @throws IllegalStateException if the
src/main/java/com/thealgorithms/datastructures/queues/CircularQueue.java:113
↓ 5 callersMethodpeek
Returns the item at the top of the stack without removing it. @return the item at the top of the stack, or {@code null} if the stack is empty @throws
src/main/java/com/thealgorithms/datastructures/stacks/NodeStack.java:74
↓ 5 callersMethodpop
Removes the top element from the stack.
src/main/java/com/thealgorithms/stacks/MinStackUsingSingleStack.java:36
↓ 5 callersMethodremove
If data is present in BST delete it else do nothing. @param data the value to be removed
src/main/java/com/thealgorithms/datastructures/trees/BSTRecursive.java:131
↓ 5 callersMethodremove
A method to delete the node in BST. If node is present it will be deleted @param data the value that needs to be deleted
src/main/java/com/thealgorithms/datastructures/trees/BSTIterative.java:91
↓ 5 callersMethodreverse
(int n)
src/main/java/com/thealgorithms/maths/PalindromePrime.java:40
↓ 5 callersMethodrotateLeft
(Node node)
src/main/java/com/thealgorithms/datastructures/trees/RedBlackBST.java:137
↓ 5 callersMethodrotateRight
Performs a right rotation on the given array by the specified number of positions. @param arr the array to be rotated @param k the number of position
src/main/java/com/thealgorithms/others/ArrayRightRotation.java:21
↓ 5 callersMethodrotateRight
(Node node)
src/main/java/com/thealgorithms/datastructures/trees/RedBlackBST.java:162
↓ 5 callersMethodrotation
Move {@code n} characters in front of given string to the end of string time complexity: O(n) space complexity: O(n) @param s given string @param n t
src/main/java/com/thealgorithms/strings/Rotation.java:29
↓ 5 callersMethodround
Rounds a number to the nearest integer. @param x the input number @return the nearest integer value as a double
src/main/java/com/thealgorithms/geometry/WusLine.java:232
↓ 5 callersMethodrun
The run method for the thread, performing the linear search in its segment.
src/main/java/com/thealgorithms/searches/LinearSearchThread.java:55
↓ 5 callersMethodschedule
Schedules the tasks randomly and returns the randomized order. @return A list representing the tasks in their randomized execution order.
src/main/java/com/thealgorithms/scheduling/RandomScheduling.java:40
← previousnext →701–800 of 8,444, ranked by callers