repo stringclasses 1k
values | file_url stringlengths 96 373 | file_path stringlengths 11 294 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 6
values | commit_sha stringclasses 1k
values | retrieved_at stringdate 2026-01-04 14:45:56 2026-01-04 18:30:23 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/stacks/TrappingRainwater.java | src/main/java/com/thealgorithms/stacks/TrappingRainwater.java | package com.thealgorithms.stacks;
/**
* Trapping Rainwater Problem
* Given an array of non-negative integers representing the height of bars,
* compute how much water it can trap after raining.
*
* Example:
* Input: [4,2,0,3,2,5]
* Output: 9
*
* Time Complexity: O(n)
* Space Complexity: O(1)
*
* Reference: ... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/stacks/MinStackUsingTwoStacks.java | src/main/java/com/thealgorithms/stacks/MinStackUsingTwoStacks.java | package com.thealgorithms.stacks;
import java.util.Stack;
/**
* Min-Stack implementation that supports push, pop, and retrieving the minimum element in constant time.
*
* @author Hardvan
*/
public final class MinStackUsingTwoStacks {
MinStackUsingTwoStacks() {
}
private final Stack<Integer> stack = n... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/stacks/InfixToPrefix.java | src/main/java/com/thealgorithms/stacks/InfixToPrefix.java | package com.thealgorithms.stacks;
import java.util.Stack;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Utility class for converting an infix arithmetic expression
* into its equivalent prefix notation expression.
* <p>
* This class provides a static method to perform the conversion,
* va... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/stacks/BalancedBrackets.java | src/main/java/com/thealgorithms/stacks/BalancedBrackets.java | package com.thealgorithms.stacks;
import java.util.Stack;
/**
* The nested brackets problem is a problem that determines if a sequence of
* brackets are properly nested. A sequence of brackets s is considered properly
* nested if any of the following conditions are true: - s is empty - s has the
* form (U) or [U]... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/stacks/LargestRectangle.java | src/main/java/com/thealgorithms/stacks/LargestRectangle.java | package com.thealgorithms.stacks;
import java.util.Stack;
/**
* Utility class to calculate the largest rectangle area in a histogram.
* Each bar's width is assumed to be 1 unit.
*
* <p>This implementation uses a monotonic stack to efficiently calculate
* the area of the largest rectangle that can be formed from ... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/stacks/MaximumMinimumWindow.java | src/main/java/com/thealgorithms/stacks/MaximumMinimumWindow.java | package com.thealgorithms.stacks;
import java.util.Arrays;
import java.util.Stack;
/**
* Given an integer array. The task is to find the maximum of the minimum of
* every window size in the array. Note: Window size varies from 1 to the size
* of the Array.
* <p>
* For example,
* <p>
* N = 7
* arr[] = {10,20,3... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/stacks/SortStack.java | src/main/java/com/thealgorithms/stacks/SortStack.java | package com.thealgorithms.stacks;
import java.util.Stack;
/**
* A utility class that provides a method to sort a stack using recursion.
* The elements are sorted in ascending order, with the largest element at the top.
* This algorithm is implemented using only recursion and the original stack,
* without utilizin... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/stacks/InfixToPostfix.java | src/main/java/com/thealgorithms/stacks/InfixToPostfix.java | package com.thealgorithms.stacks;
import java.util.Stack;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Utility class for converting an infix arithmetic expression
* into its equivalent postfix (Reverse Polish Notation) form.
* <p>
* This class provides a static method to perform the conve... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/stacks/StackPostfixNotation.java | src/main/java/com/thealgorithms/stacks/StackPostfixNotation.java | package com.thealgorithms.stacks;
import java.util.Scanner;
import java.util.Stack;
import java.util.function.BiFunction;
/**
* Utility class for evaluating postfix expressions using integer arithmetic.
* <p>
* Postfix notation, also known as Reverse Polish Notation (RPN), is a mathematical notation in which opera... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/stacks/PrefixEvaluator.java | src/main/java/com/thealgorithms/stacks/PrefixEvaluator.java | package com.thealgorithms.stacks;
import java.util.Set;
import java.util.Stack;
/**
* Evaluate a prefix (Polish) expression using a stack.
*
* <p>Example: Expression "+ * 2 3 4" results in 10.
* <p>Applications: Useful for implementing compilers and interpreters.
*
* @author Hardvan
*/
public final class Prefi... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/stacks/NextGreaterElement.java | src/main/java/com/thealgorithms/stacks/NextGreaterElement.java | package com.thealgorithms.stacks;
import java.util.Stack;
/**
* Utility class to find the next greater element for each element in a given integer array.
*
* <p>The next greater element for an element x is the first greater element on the right side of x in the array.
* If no such element exists, the result will ... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/graph/ConstrainedShortestPath.java | src/main/java/com/thealgorithms/graph/ConstrainedShortestPath.java | package com.thealgorithms.graph;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* This class implements a solution for the Constrained Shortest Path Problem (CSPP).
* also known as Shortest Path Problem with Resource Constraints (SPPRC).
* The goal is to find the shortest path betw... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/graph/EdmondsKarp.java | src/main/java/com/thealgorithms/graph/EdmondsKarp.java | package com.thealgorithms.graph;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Queue;
/**
* Implementation of the Edmonds–Karp algorithm for computing the maximum flow of a directed graph.
* <p>
* The algorithm runs in O(V * E^2) time and is a specific implementation of the Ford–Fulkerson
... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/graph/GomoryHuTree.java | src/main/java/com/thealgorithms/graph/GomoryHuTree.java | package com.thealgorithms.graph;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Queue;
/**
* Gomory–Hu tree construction for undirected graphs via n−1 max-flow computations.
*
* <p>API: {@code buildTree(int[][])} returns {@code {parent, weight}} arrays for the tree.
*
* @see <a href="http... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/graph/Dinic.java | src/main/java/com/thealgorithms/graph/Dinic.java | package com.thealgorithms.graph;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Queue;
/**
* Dinic's algorithm for computing maximum flow in a directed graph.
*
* <p>Time complexity: O(E * V^2) in the worst case, but typically faster in practice
* and near O(E * sqrt(V)) for unit networks.... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/graph/StoerWagner.java | src/main/java/com/thealgorithms/graph/StoerWagner.java | package com.thealgorithms.graph;
/**
* An implementation of the Stoer-Wagner algorithm to find the global minimum cut of an undirected, weighted graph.
* A minimum cut is a partition of the graph's vertices into two disjoint sets with the minimum possible edge weight
* sum connecting the two sets.
*
* Wikipedia: ... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/graph/HungarianAlgorithm.java | src/main/java/com/thealgorithms/graph/HungarianAlgorithm.java | package com.thealgorithms.graph;
import java.util.Arrays;
/**
* Hungarian algorithm (a.k.a. Kuhn–Munkres) for the Assignment Problem.
*
* <p>Given an n x m cost matrix (n tasks, m workers), finds a minimum-cost
* one-to-one assignment. If the matrix is rectangular, the algorithm pads to a
* square internally. Co... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/graph/BronKerbosch.java | src/main/java/com/thealgorithms/graph/BronKerbosch.java | package com.thealgorithms.graph;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* Implementation of the Bron–Kerbosch algorithm with pivoting for enumerating all maximal cliques
* in an undirected graph.
*
* <p>The input graph is represented as an adjacency ... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/graph/TravelingSalesman.java | src/main/java/com/thealgorithms/graph/TravelingSalesman.java | package com.thealgorithms.graph;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
/**
* This class provides solutions to the Traveling Salesman Problem (TSP) using both brute-force and dynamic programming approaches.
* For more information, see <a href="https... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/graph/Edmonds.java | src/main/java/com/thealgorithms/graph/Edmonds.java | package com.thealgorithms.graph;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* An implementation of Edmonds's algorithm (also known as the Chu–Liu/Edmonds algorithm)
* for finding a Minimum Spanning Arborescence (MSA).
*
* <p>An MSA is a directed graph equivalent of a Minimum S... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/graph/PredecessorConstrainedDfs.java | src/main/java/com/thealgorithms/graph/PredecessorConstrainedDfs.java | package com.thealgorithms.graph;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
/**
* DFS that visits a successor only when all its predecessors are already visi... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/graph/PushRelabel.java | src/main/java/com/thealgorithms/graph/PushRelabel.java | package com.thealgorithms.graph;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Queue;
/**
* Push–Relabel (Relabel-to-Front variant simplified to array scanning) for maximum flow.
*
* <p>Input graph is a capacity matrix where {@code capacity[u][v]} is the capacity of the edge
* {@code u ->... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/graph/StronglyConnectedComponentOptimized.java | src/main/java/com/thealgorithms/graph/StronglyConnectedComponentOptimized.java | package com.thealgorithms.graph;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Stack;
/**
* Finds the strongly connected components in a directed graph.
*
* @param adjList The adjacency list representation of the graph.
* @param n The number... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/graph/HierholzerEulerianPath.java | src/main/java/com/thealgorithms/graph/HierholzerEulerianPath.java | package com.thealgorithms.graph;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Deque;
import java.util.List;
/**
* Implementation of Hierholzer's Algorithm for finding an Eulerian Path or Circuit
* in a directed graph.
*
* <p>
* An <b>Eulerian Circuit</b>... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/graph/YensKShortestPaths.java | src/main/java/com/thealgorithms/graph/YensKShortestPaths.java | package com.thealgorithms.graph;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.PriorityQueue;
import java.util.Set;
/**
* Yen's algorithm for finding K loopless shortest paths in a directed graph with non-negative edge... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/graph/HierholzerAlgorithm.java | src/main/java/com/thealgorithms/graph/HierholzerAlgorithm.java | package com.thealgorithms.graph;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Stack;
/**
* Implementation of Hierholzer's algorithm to find an Eulerian Circuit in an u... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/graph/ZeroOneBfs.java | src/main/java/com/thealgorithms/graph/ZeroOneBfs.java | package com.thealgorithms.graph;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Deque;
import java.util.List;
/**
* 0-1 BFS for shortest paths on graphs with edges weighted 0 or 1.
*
* <p>Time Complexity: O(V + E). Space Complexity: O(V).
*
* <p>References:
* <ul>
* <li>https://cp-alg... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/graph/HopcroftKarp.java | src/main/java/com/thealgorithms/graph/HopcroftKarp.java | package com.thealgorithms.graph;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.List;
import java.util.Queue;
/**
* Hopcroft–Karp algorithm for maximum bipartite matching.
*
* Left part: vertices [0,nLeft-1], Right part: [0,nRight-1].
* Adjacency list: for each left vertex u, list right ve... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/greedyalgorithms/MergeIntervals.java | src/main/java/com/thealgorithms/greedyalgorithms/MergeIntervals.java | package com.thealgorithms.greedyalgorithms;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* Problem Statement:
* Given an array of intervals where intervals[i] = [starti, endi].
*
* Merge all overlapping intervals and return an array of the non-overlapping
* intervals
* that co... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/greedyalgorithms/JobSequencing.java | src/main/java/com/thealgorithms/greedyalgorithms/JobSequencing.java | package com.thealgorithms.greedyalgorithms;
import java.util.ArrayList;
import java.util.Arrays;
// Problem Link: https://en.wikipedia.org/wiki/Job-shop_scheduling
public final class JobSequencing {
private JobSequencing() {
}
// Define a Job class that implements Comparable for sorting by profit in des... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/greedyalgorithms/FractionalKnapsack.java | src/main/java/com/thealgorithms/greedyalgorithms/FractionalKnapsack.java | package com.thealgorithms.greedyalgorithms;
import java.util.Arrays;
import java.util.Comparator;
/**
* The FractionalKnapsack class provides a method to solve the fractional knapsack problem
* using a greedy algorithm approach. It allows for selecting fractions of items to maximize
* the total value in a knapsack... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/greedyalgorithms/KCenters.java | src/main/java/com/thealgorithms/greedyalgorithms/KCenters.java | package com.thealgorithms.greedyalgorithms;
import java.util.Arrays;
/**
* Given a set of points and a number k.
* The goal is to minimize the maximum distance between any point and its nearest center.
* Each point is assigned to the nearest center.
* The distance between two points is the Euclidean distance.
* ... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/greedyalgorithms/BinaryAddition.java | src/main/java/com/thealgorithms/greedyalgorithms/BinaryAddition.java | package com.thealgorithms.greedyalgorithms;
import java.util.Collections;
/**
* BinaryAddition class to perform binary addition of two binary strings.
*/
public class BinaryAddition {
/**
* Computes the sum of two binary characters and a carry.
* @param a First binary character ('0' or '1').
* @p... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/greedyalgorithms/CoinChange.java | src/main/java/com/thealgorithms/greedyalgorithms/CoinChange.java | package com.thealgorithms.greedyalgorithms;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
// Problem Link : https://en.wikipedia.org/wiki/Change-making_problem
public final class CoinChange {
private CoinChange() {
}
// Function to solve the coin change problem
pub... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/greedyalgorithms/OptimalFileMerging.java | src/main/java/com/thealgorithms/greedyalgorithms/OptimalFileMerging.java | package com.thealgorithms.greedyalgorithms;
import java.util.PriorityQueue;
/**
* Class to solve the Optimal File Merging Problem.
* The goal is to minimize the cost of merging files, where the cost of merging two files is the sum of their sizes.
* The cost of merging all files is the sum of the costs of merging e... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/greedyalgorithms/StockProfitCalculator.java | src/main/java/com/thealgorithms/greedyalgorithms/StockProfitCalculator.java | package com.thealgorithms.greedyalgorithms;
/**
* The StockProfitCalculator class provides a method to calculate the maximum profit
* that can be made from a single buy and sell of one share of stock.
* The approach uses a greedy algorithm to efficiently determine the maximum profit.
*
* @author Hardvan
*/
publi... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/greedyalgorithms/MinimizingLateness.java | src/main/java/com/thealgorithms/greedyalgorithms/MinimizingLateness.java | package com.thealgorithms.greedyalgorithms;
import java.util.Arrays;
public final class MinimizingLateness {
private MinimizingLateness() {
}
public static class Job {
String jobName;
int startTime = 0;
int lateness = 0;
int processingTime;
int deadline;
p... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/greedyalgorithms/BandwidthAllocation.java | src/main/java/com/thealgorithms/greedyalgorithms/BandwidthAllocation.java | package com.thealgorithms.greedyalgorithms;
import java.util.Arrays;
/**
* Class to solve the Bandwidth Allocation Problem.
* The goal is to maximize the value gained by allocating bandwidth to users.
* Example:
* Bandwidth = 10
* Users = [3, 5, 7]
* Values = [10, 20, 30]
* The maximum value achievable is 40 b... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/greedyalgorithms/DigitSeparation.java | src/main/java/com/thealgorithms/greedyalgorithms/DigitSeparation.java | package com.thealgorithms.greedyalgorithms;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* This class provides methods to separate the digits of a large positive number into a list.
*/
public class DigitSeparation {
public DigitSeparation() {
}
/**
* Separate... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/greedyalgorithms/EgyptianFraction.java | src/main/java/com/thealgorithms/greedyalgorithms/EgyptianFraction.java | package com.thealgorithms.greedyalgorithms;
import java.util.ArrayList;
import java.util.List;
/**
* Class to represent a fraction as a sum of unique unit fractions.
* Example:
* 2/3 = 1/2 + 1/6
* 3/10 = 1/4 + 1/20
*
* @author Hardvan
*/
public final class EgyptianFraction {
private EgyptianFraction() {
... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/greedyalgorithms/GaleShapley.java | src/main/java/com/thealgorithms/greedyalgorithms/GaleShapley.java | package com.thealgorithms.greedyalgorithms;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
/**
* Implementation of the Gale-Shapley Algorithm for Stable Matching.
* Problem link: https://en.wikipedia.org/wiki/Stable_marriage_problem
*/
public final class GaleShapley {
private Gal... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/greedyalgorithms/MinimumWaitingTime.java | src/main/java/com/thealgorithms/greedyalgorithms/MinimumWaitingTime.java | package com.thealgorithms.greedyalgorithms;
import java.util.Arrays;
/**
* The MinimumWaitingTime class provides a method to calculate the minimum
* waiting time for a list of queries using a greedy algorithm.
*
* @author Hardvan
*/
public final class MinimumWaitingTime {
private MinimumWaitingTime() {
}... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/greedyalgorithms/ActivitySelection.java | src/main/java/com/thealgorithms/greedyalgorithms/ActivitySelection.java | package com.thealgorithms.greedyalgorithms;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
// Problem Link: https://en.wikipedia.org/wiki/Activity_selection_problem
public final class ActivitySelection {
// Private constructor to prevent instantiation of the utility class
... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/matrix/RotateMatrixBy90Degrees.java | src/main/java/com/thealgorithms/matrix/RotateMatrixBy90Degrees.java | package com.thealgorithms.matrix;
import java.util.Scanner;
/**
* Given a matrix of size n x n We have to rotate this matrix by 90 Degree Here
* is the algorithm for this problem .
*/
final class RotateMatrixBy90Degrees {
private RotateMatrixBy90Degrees() {
}
public static void main(String[] args) {
... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/matrix/MatrixMultiplication.java | src/main/java/com/thealgorithms/matrix/MatrixMultiplication.java | package com.thealgorithms.matrix;
/**
* This class provides a method to perform matrix multiplication.
*
* <p>Matrix multiplication takes two 2D arrays (matrices) as input and
* produces their product, following the mathematical definition of
* matrix multiplication.
*
* <p>For more details:
* https://www.geek... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/matrix/LUDecomposition.java | src/main/java/com/thealgorithms/matrix/LUDecomposition.java | package com.thealgorithms.matrix;
/**
* LU Decomposition algorithm
* --------------------------
* Decomposes a square matrix a into a product of two matrices:
* a = l * u
* where:
* - l is a lower triangular matrix with 1s on its diagonal
* - u is an upper triangular matrix
*
* Reference:
* https://en.wikipe... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/matrix/InverseOfMatrix.java | src/main/java/com/thealgorithms/matrix/InverseOfMatrix.java | package com.thealgorithms.matrix;
/**
* This class provides methods to compute the inverse of a square matrix
* using Gaussian elimination. For more details, refer to:
* https://en.wikipedia.org/wiki/Invertible_matrix
*/
public final class InverseOfMatrix {
private InverseOfMatrix() {
}
public static ... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/matrix/MirrorOfMatrix.java | src/main/java/com/thealgorithms/matrix/MirrorOfMatrix.java | package com.thealgorithms.matrix;
// Problem Statement
import com.thealgorithms.matrix.utils.MatrixUtil;
/*
We have given an array of m x n (where m is the number of rows and n is the number of columns).
Print the new matrix in such a way that the new matrix is the mirror image of the original matrix.
The Original ... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/matrix/MedianOfMatrix.java | src/main/java/com/thealgorithms/matrix/MedianOfMatrix.java | package com.thealgorithms.matrix;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* Median of Matrix (https://medium.com/@vaibhav.yadav8101/median-in-a-row-wise-sorted-matrix-901737f3e116)
* Author: Bama Charan Chhandogi (https://github.com/BamaCharanChhandogi)
*/
public final... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/matrix/PrintAMatrixInSpiralOrder.java | src/main/java/com/thealgorithms/matrix/PrintAMatrixInSpiralOrder.java | package com.thealgorithms.matrix;
import java.util.ArrayList;
import java.util.List;
/**
* Utility class to print a matrix in spiral order.
* <p>
* Given a 2D array (matrix), this class provides a method to return the
* elements
* of the matrix in spiral order, starting from the top-left corner and moving
* clo... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/matrix/SolveSystem.java | src/main/java/com/thealgorithms/matrix/SolveSystem.java | package com.thealgorithms.matrix;
/**
* This class implements an algorithm for solving a system of equations of the form Ax=b using gaussian elimination and back substitution.
*
* @link <a href="https://en.wikipedia.org/wiki/Gaussian_elimination">Gaussian Elimination Wiki</a>
* @see InverseOfMatrix finds the full ... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/matrix/MatrixRank.java | src/main/java/com/thealgorithms/matrix/MatrixRank.java | package com.thealgorithms.matrix;
import static com.thealgorithms.matrix.utils.MatrixUtil.validateInputMatrix;
/**
* This class provides a method to compute the rank of a matrix.
* In linear algebra, the rank of a matrix is the maximum number of linearly independent rows or columns in the matrix.
* For example, co... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/matrix/StochasticMatrix.java | src/main/java/com/thealgorithms/matrix/StochasticMatrix.java | package com.thealgorithms.matrix;
/**
* Utility class to check whether a matrix is stochastic.
* A matrix is stochastic if all its elements are non-negative
* and the sum of each row or column is equal to 1.
*Reference: https://en.wikipedia.org/wiki/Stochastic_matrix
*/
public final class StochasticMatrix {
... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/matrix/MatrixTranspose.java | src/main/java/com/thealgorithms/matrix/MatrixTranspose.java | package com.thealgorithms.matrix;
/**
*
*
* <h1>Find the Transpose of Matrix!</h1>
*
* Simply take input from the user and print the matrix before the transpose and
* after the transpose.
*
* <p>
* <b>Note:</b> Giving proper comments in your program makes it more user
* friendly and it is assumed as a high q... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/matrix/matrixexponentiation/Fibonacci.java | src/main/java/com/thealgorithms/matrix/matrixexponentiation/Fibonacci.java | package com.thealgorithms.matrix.matrixexponentiation;
import com.thealgorithms.matrix.utils.MatrixUtil;
import java.math.BigDecimal;
/**
* @author Anirudh Buvanesh (https://github.com/anirudhb11) For more information
* see https://www.geeksforgeeks.org/matrix-exponentiation/
*
*/
public final class Fibonacci {
... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/matrix/utils/MatrixUtil.java | src/main/java/com/thealgorithms/matrix/utils/MatrixUtil.java | package com.thealgorithms.matrix.utils;
import java.math.BigDecimal;
import java.util.Optional;
import java.util.function.BiFunction;
import java.util.stream.IntStream;
/**
* @author: caos321
* @date: 31 October 2021 (Sunday)
*/
public final class MatrixUtil {
private MatrixUtil() {
}
private static ... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/geometry/DDALine.java | src/main/java/com/thealgorithms/geometry/DDALine.java | package com.thealgorithms.geometry;
import java.awt.Point;
import java.util.ArrayList;
import java.util.List;
/**
* The {@code DDALine} class implements the Digital Differential Analyzer (DDA)
* line drawing algorithm. It computes points along a line between two given
* endpoints using floating-point arithmetic.
... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/geometry/ConvexHull.java | src/main/java/com/thealgorithms/geometry/ConvexHull.java | package com.thealgorithms.geometry;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
/**
* A class providing algorithms to compute the convex hull of a s... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/geometry/WusLine.java | src/main/java/com/thealgorithms/geometry/WusLine.java | package com.thealgorithms.geometry;
import java.awt.Point;
import java.util.ArrayList;
import java.util.List;
/**
* The {@code WusLine} class implements Xiaolin Wu's line drawing algorithm,
* which produces anti-aliased lines by varying pixel brightness
* according to the line's proximity to pixel centers.
*
* T... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/geometry/MidpointCircle.java | src/main/java/com/thealgorithms/geometry/MidpointCircle.java | package com.thealgorithms.geometry;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
/**
* Class to represent the Midpoint Circle Algorithm.
* This algorithm calculates points on the circumference of a circle
* using integer arithmetic for efficient computation.
*/
public final clas... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/geometry/Point.java | src/main/java/com/thealgorithms/geometry/Point.java | package com.thealgorithms.geometry;
import java.util.Comparator;
public record Point(int x, int y) implements Comparable<Point> {
@Override
public int compareTo(Point other) {
int cmpY = Integer.compare(this.y, other.y);
return cmpY != 0 ? cmpY : Integer.compare(this.x, other.x);
}
@... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/geometry/Haversine.java | src/main/java/com/thealgorithms/geometry/Haversine.java | package com.thealgorithms.geometry;
/**
* This Class implements the Haversine formula to calculate the distance between two points on a sphere (like Earth) from their latitudes and longitudes.
*
* The Haversine formula is used in navigation and mapping to find the great-circle distance,
* which is the shortest dist... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/geometry/GrahamScan.java | src/main/java/com/thealgorithms/geometry/GrahamScan.java | package com.thealgorithms.geometry;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Stack;
/**
* A Java program that computes the convex hull using the Graham Scan algorithm.
* The time complexity is O(n) in the best case and O(n log(n)) in the worst case.
* The space complexity is O(n).
* T... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/geometry/BresenhamLine.java | src/main/java/com/thealgorithms/geometry/BresenhamLine.java | package com.thealgorithms.geometry;
import java.awt.Point;
import java.util.ArrayList;
import java.util.List;
/**
* The {@code BresenhamLine} class implements the Bresenham's line algorithm,
* which is an efficient way to determine the points of a straight line
* between two given points in a 2D space.
*
* <p>Th... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/geometry/MidpointEllipse.java | src/main/java/com/thealgorithms/geometry/MidpointEllipse.java | package com.thealgorithms.geometry;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
/**
* The MidpointEllipse class implements the Midpoint Ellipse Drawing Algorithm.
* This algorithm efficiently computes the points on an ellipse by dividing it into two regions
* and using decision ... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/geometry/BentleyOttmann.java | src/main/java/com/thealgorithms/geometry/BentleyOttmann.java | package com.thealgorithms.geometry;
import java.awt.geom.Point2D;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.NavigableSet;
import java.util.Objects;
import java.util.PriorityQueue;
import jav... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/conversions/NumberToWords.java | src/main/java/com/thealgorithms/conversions/NumberToWords.java | package com.thealgorithms.conversions;
import java.math.BigDecimal;
/**
A Java-based utility for converting numeric values into their English word
representations. Whether you need to convert a small number, a large number
with millions and billions, or even a number with decimal places, this utility
has you cove... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/conversions/TimeConverter.java | src/main/java/com/thealgorithms/conversions/TimeConverter.java | package com.thealgorithms.conversions;
import java.util.Locale;
import java.util.Map;
/**
* A utility class to convert between different units of time.
*
* <p>This class supports conversions between the following units:
* <ul>
* <li>seconds</li>
* <li>minutes</li>
* <li>hours</li>
* <li>days</li>
* ... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/conversions/EndianConverter.java | src/main/java/com/thealgorithms/conversions/EndianConverter.java | package com.thealgorithms.conversions;
/**
* Utility class for converting integers between big-endian and little-endian formats.
* <p>
* Endianness defines how byte sequences represent multi-byte data types:
* <ul>
* <li><b>Big-endian</b>: The most significant byte (MSB) comes first.</li>
* <li><b>Little-end... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/conversions/IntegerToEnglish.java | src/main/java/com/thealgorithms/conversions/IntegerToEnglish.java | package com.thealgorithms.conversions;
import java.util.Map;
/**
* A utility class to convert integers to their English word representation.
*
* <p>The class supports conversion of numbers from 0 to 2,147,483,647
* (the maximum value of a 32-bit signed integer). It divides the number
* into groups of three digit... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/conversions/HexaDecimalToDecimal.java | src/main/java/com/thealgorithms/conversions/HexaDecimalToDecimal.java | package com.thealgorithms.conversions;
/**
* Utility class for converting a hexadecimal string to its decimal representation.
* <p>
* A hexadecimal number uses the base-16 numeral system, with the following characters:
* <ul>
* <li>Digits: 0-9</li>
* <li>Letters: A-F (case-insensitive)</li>
* </ul>
* Each ... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/conversions/CoordinateConverter.java | src/main/java/com/thealgorithms/conversions/CoordinateConverter.java | package com.thealgorithms.conversions;
/**
* A utility class to convert between Cartesian and Polar coordinate systems.
*
* <p>This class provides methods to perform the following conversions:
* <ul>
* <li>Cartesian to Polar coordinates</li>
* <li>Polar to Cartesian coordinates</li>
* </ul>
*
* <p>The cla... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/conversions/AffineConverter.java | src/main/java/com/thealgorithms/conversions/AffineConverter.java | package com.thealgorithms.conversions;
/**
* A utility class to perform affine transformations of the form:
* y = slope * x + intercept.
*
* This class supports inversion and composition of affine transformations.
* It is immutable, meaning each instance represents a fixed transformation.
*/
public final class A... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/conversions/HexaDecimalToBinary.java | src/main/java/com/thealgorithms/conversions/HexaDecimalToBinary.java | package com.thealgorithms.conversions;
/**
* Utility class for converting hexadecimal numbers to binary representation.
* <p>
* A hexadecimal number consists of digits from {@code [0-9]} and {@code [A-F]} (case-insensitive),
* while binary representation uses only {@code [0, 1]}.
* <p>
* This class provides meth... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/conversions/IPv6Converter.java | src/main/java/com/thealgorithms/conversions/IPv6Converter.java | package com.thealgorithms.conversions;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Arrays;
/**
* A utility class for converting between IPv6 and IPv4 addresses.
*
* - Converts IPv4 to IPv6-mapped IPv6 address.
* - Extracts IPv4 address from IPv6-mapped IPv6.
* - Handles ex... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/conversions/DecimalToBinary.java | src/main/java/com/thealgorithms/conversions/DecimalToBinary.java | package com.thealgorithms.conversions;
/**
* This class provides methods to convert a decimal number to a binary number.
*/
final class DecimalToBinary {
private static final int BINARY_BASE = 2;
private static final int DECIMAL_MULTIPLIER = 10;
private DecimalToBinary() {
}
/**
* Converts... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/conversions/BinaryToDecimal.java | src/main/java/com/thealgorithms/conversions/BinaryToDecimal.java | package com.thealgorithms.conversions;
/**
* This class converts a Binary number to a Decimal number
*/
final class BinaryToDecimal {
private static final int BINARY_BASE = 2;
private BinaryToDecimal() {
}
/**
* Converts a binary number to its decimal equivalent.
*
* @param binaryNum... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/conversions/OctalToBinary.java | src/main/java/com/thealgorithms/conversions/OctalToBinary.java | package com.thealgorithms.conversions;
/**
* A utility class to convert an octal (base-8) number into its binary (base-2) representation.
*
* <p>This class provides methods to:
* <ul>
* <li>Convert an octal number to its binary equivalent</li>
* <li>Convert individual octal digits to binary</li>
* </ul>... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/conversions/UnitsConverter.java | src/main/java/com/thealgorithms/conversions/UnitsConverter.java | package com.thealgorithms.conversions;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Set;
import org.apache.commons.lang3.tuple.Pair;
/**
* A class that handles unit conversions using affine transformations.
*
* <p>The {@code Uni... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/conversions/DecimalToAnyBase.java | src/main/java/com/thealgorithms/conversions/DecimalToAnyBase.java | package com.thealgorithms.conversions;
import java.util.ArrayList;
import java.util.List;
/**
* Class that provides methods to convert a decimal number to a string representation
* in any specified base between 2 and 36.
*
* @author Varun Upadhyay (<a href="https://github.com/varunu28">...</a>)
*/
public final... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/conversions/DecimalToHexadecimal.java | src/main/java/com/thealgorithms/conversions/DecimalToHexadecimal.java | package com.thealgorithms.conversions;
/**
* This class provides a method to convert a decimal number to a hexadecimal string.
*/
final class DecimalToHexadecimal {
private static final int SIZE_OF_INT_IN_HALF_BYTES = 8;
private static final int NUMBER_OF_BITS_IN_HALF_BYTE = 4;
private static final int H... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/conversions/IPConverter.java | src/main/java/com/thealgorithms/conversions/IPConverter.java | package com.thealgorithms.conversions;
/**
* Converts an IPv4 address to its binary equivalent and vice-versa.
* IP to Binary: Converts an IPv4 address to its binary equivalent.
* Example: 127.3.4.5 -> 01111111.00000011.00000100.00000101
*
* Binary to IP: Converts a binary equivalent to an IPv4 address.
* Exampl... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/conversions/HexToOct.java | src/main/java/com/thealgorithms/conversions/HexToOct.java | package com.thealgorithms.conversions;
/**
* Converts any Hexadecimal Number to Octal
*
* @author Tanmay Joshi
*/
public final class HexToOct {
private HexToOct() {
}
/**
* Converts a Hexadecimal number to a Decimal number.
*
* @param hex The Hexadecimal number as a String.
* @retu... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/conversions/RomanToInteger.java | src/main/java/com/thealgorithms/conversions/RomanToInteger.java | package com.thealgorithms.conversions;
import java.util.HashMap;
import java.util.Map;
/**
* A utility class to convert Roman numerals into integers.
*
* <p>Roman numerals are based on seven symbols given below:
* <ul>
* <li>I = 1</li>
* <li>V = 5</li>
* <li>X = 10</li>
* <li>L = 50</li>
* <li>C = ... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/conversions/AnyBaseToAnyBase.java | src/main/java/com/thealgorithms/conversions/AnyBaseToAnyBase.java | package com.thealgorithms.conversions;
import java.util.Arrays;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.Scanner;
/**
* Class for converting from "any" base to "any" other base, when "any" means
* from 2-36. Works by going from base 1 to decimal to base 2. Includes
* auxi... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/conversions/RgbHsvConversion.java | src/main/java/com/thealgorithms/conversions/RgbHsvConversion.java | package com.thealgorithms.conversions;
import java.util.Arrays;
/**
* The RGB color model is an additive color model in which red, green, and blue
* light are added together in various ways to reproduce a broad array of
* colors. The name of the model comes from the initials of the three additive
* primary colors... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/conversions/OctalToDecimal.java | src/main/java/com/thealgorithms/conversions/OctalToDecimal.java | package com.thealgorithms.conversions;
/**
* Class for converting an octal number to a decimal number. Octal numbers are based on 8, using digits from 0 to 7.
*
*/
public final class OctalToDecimal {
private static final int OCTAL_BASE = 8;
private OctalToDecimal() {
}
/**
* Converts a given ... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/conversions/TurkishToLatinConversion.java | src/main/java/com/thealgorithms/conversions/TurkishToLatinConversion.java | package com.thealgorithms.conversions;
/**
* Converts turkish character to latin character
*
* @author Özgün Gökşenli
*/
public final class TurkishToLatinConversion {
private TurkishToLatinConversion() {
}
/**
* This method converts a turkish character to latin character.
* Steps:
* 1. ... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/conversions/AnytoAny.java | src/main/java/com/thealgorithms/conversions/AnytoAny.java | package com.thealgorithms.conversions;
/**
* A utility class for converting numbers from any base to any other base.
*
* This class provides a method to convert a source number from a given base
* to a destination number in another base. Valid bases range from 2 to 10.
*/
public final class AnytoAny {
private... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/conversions/AnyBaseToDecimal.java | src/main/java/com/thealgorithms/conversions/AnyBaseToDecimal.java | package com.thealgorithms.conversions;
/**
* @author Varun Upadhyay (<a href="https://github.com/varunu28">...</a>)
*/
public final class AnyBaseToDecimal {
private static final int CHAR_OFFSET_FOR_DIGIT = '0';
private static final int CHAR_OFFSET_FOR_UPPERCASE = 'A' - 10;
private AnyBaseToDecimal() {
... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/conversions/WordsToNumber.java | src/main/java/com/thealgorithms/conversions/WordsToNumber.java | package com.thealgorithms.conversions;
import java.io.Serial;
import java.math.BigDecimal;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
/**
A Java-based utility for converting English word representations of numbers
into their numeric form. This utilit... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/conversions/PhoneticAlphabetConverter.java | src/main/java/com/thealgorithms/conversions/PhoneticAlphabetConverter.java | package com.thealgorithms.conversions;
import java.util.HashMap;
import java.util.Map;
/**
* Converts text to the NATO phonetic alphabet.
* Examples:
* "ABC" -> "Alpha Bravo Charlie"
* "Hello" -> "Hotel Echo Lima Lima Oscar"
* "123" -> "One Two Three"
* "A1B2C3" -> "Alpha One Bravo Two Charlie Three"
*
* @aut... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/conversions/UnitConversions.java | src/main/java/com/thealgorithms/conversions/UnitConversions.java | package com.thealgorithms.conversions;
import static java.util.Map.entry;
import java.util.Map;
import org.apache.commons.lang3.tuple.Pair;
/**
* A utility class to perform unit conversions between different measurement systems.
*
* <p>Currently, the class supports temperature conversions between several scales:
... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/conversions/Base64.java | src/main/java/com/thealgorithms/conversions/Base64.java | package com.thealgorithms.conversions;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
/**
* Base64 is a group of binary-to-text encoding schemes that represent binary data
* in an ASCII string format by translating it into a radix-64 representation.
* Each base64 digit... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/conversions/DecimalToOctal.java | src/main/java/com/thealgorithms/conversions/DecimalToOctal.java | package com.thealgorithms.conversions;
/**
* This class converts Decimal numbers to Octal Numbers
*/
public final class DecimalToOctal {
private static final int OCTAL_BASE = 8;
private static final int INITIAL_OCTAL_VALUE = 0;
private static final int INITIAL_PLACE_VALUE = 1;
private DecimalToOctal... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/conversions/BinaryToOctal.java | src/main/java/com/thealgorithms/conversions/BinaryToOctal.java | package com.thealgorithms.conversions;
public final class BinaryToOctal {
private static final int BITS_PER_OCTAL_DIGIT = 3;
private static final int BINARY_BASE = 2;
private static final int DECIMAL_BASE = 10;
private BinaryToOctal() {
}
/**
* This method converts a binary number to an ... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/conversions/IntegerToRoman.java | src/main/java/com/thealgorithms/conversions/IntegerToRoman.java | package com.thealgorithms.conversions;
/**
* A utility class to convert integers into Roman numerals.
*
* <p>Roman numerals follow these rules:
* <ul>
* <li>I = 1</li>
* <li>IV = 4</li>
* <li>V = 5</li>
* <li>IX = 9</li>
* <li>X = 10</li>
* <li>XL = 40</li>
* <li>L = 50</li>
* <li>XC = 90</... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/conversions/OctalToHexadecimal.java | src/main/java/com/thealgorithms/conversions/OctalToHexadecimal.java | package com.thealgorithms.conversions;
/**
* Class for converting an Octal number to its Hexadecimal equivalent.
*
* @author Tanmay Joshi
*/
public final class OctalToHexadecimal {
private static final int OCTAL_BASE = 8;
private static final int HEX_BASE = 16;
private static final String HEX_DIGITS = ... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/conversions/TemperatureConverter.java | src/main/java/com/thealgorithms/conversions/TemperatureConverter.java | package com.thealgorithms.conversions;
/**
* A utility class to convert between different temperature units.
*
* <p>This class supports conversions between the following units:
* <ul>
* <li>Celsius</li>
* <li>Fahrenheit</li>
* <li>Kelvin</li>
* </ul>
*
* <p>This class is final and cannot be instantiate... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
TheAlgorithms/Java | https://github.com/TheAlgorithms/Java/blob/e945f1622490ff3b32e59d31780df27d0dc2ede4/src/main/java/com/thealgorithms/conversions/MorseCodeConverter.java | src/main/java/com/thealgorithms/conversions/MorseCodeConverter.java | package com.thealgorithms.conversions;
import java.util.HashMap;
import java.util.Map;
/**
* Converts text to Morse code and vice-versa.
* Text to Morse code: Each letter is separated by a space and each word is separated by a pipe (|).
* Example: "HELLO WORLD" -> ".... . .-.. .-.. --- | .-- --- .-. .-.. -.."
*
... | java | MIT | e945f1622490ff3b32e59d31780df27d0dc2ede4 | 2026-01-04T14:45:56.733479Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.