From 4bd2ee8b3b4eb6405d3078d7255417b89a07eb68 Mon Sep 17 00:00:00 2001 From: BixbyCodes Date: Sat, 16 May 2026 21:14:39 +0530 Subject: [PATCH 1/3] Fix: remove floating Javadoc comments causing compilation error --- .../conversions/AnyBaseToAnyBase.java | 8 +------- .../searches/InterpolationSearch.java | 12 +----------- .../com/thealgorithms/searches/LinearSearch.java | 14 +------------- 3 files changed, 3 insertions(+), 31 deletions(-) diff --git a/src/main/java/com/thealgorithms/conversions/AnyBaseToAnyBase.java b/src/main/java/com/thealgorithms/conversions/AnyBaseToAnyBase.java index 3d31cb3e7f6c..314e7fba38a3 100644 --- a/src/main/java/com/thealgorithms/conversions/AnyBaseToAnyBase.java +++ b/src/main/java/com/thealgorithms/conversions/AnyBaseToAnyBase.java @@ -1,10 +1,4 @@ -/** - * [Brief description of what the algorithm does] - *

- * Time Complexity: O(n) [or appropriate complexity] - * Space Complexity: O(n) - * @author Reshma Kakkirala - */ + package com.thealgorithms.conversions; import java.util.Arrays; diff --git a/src/main/java/com/thealgorithms/searches/InterpolationSearch.java b/src/main/java/com/thealgorithms/searches/InterpolationSearch.java index d24cc1c774bc..272627fc48b4 100644 --- a/src/main/java/com/thealgorithms/searches/InterpolationSearch.java +++ b/src/main/java/com/thealgorithms/searches/InterpolationSearch.java @@ -1,14 +1,4 @@ -/** - * Interpolation Search estimates the position of the target value - * based on the distribution of values. - * - * Example: - * Input: [10, 20, 30, 40], target = 30 - * Output: Index = 2 - * - * Time Complexity: O(log log n) (average case) - * Space Complexity: O(1) - */ + package com.thealgorithms.searches; /** diff --git a/src/main/java/com/thealgorithms/searches/LinearSearch.java b/src/main/java/com/thealgorithms/searches/LinearSearch.java index 3f273e167f0a..bd14fe21ea03 100644 --- a/src/main/java/com/thealgorithms/searches/LinearSearch.java +++ b/src/main/java/com/thealgorithms/searches/LinearSearch.java @@ -1,16 +1,4 @@ -/** - * Performs Linear Search on an array. - * - * Linear search checks each element one by one until the target is found - * or the array ends. - * - * Example: - * Input: [2, 4, 6, 8], target = 6 - * Output: Index = 2 - * - * Time Complexity: O(n) - * Space Complexity: O(1) - */ + package com.thealgorithms.searches; import com.thealgorithms.devutils.searches.SearchAlgorithm; From 3629971620b22fc69e0095fb4d07f523be487d4d Mon Sep 17 00:00:00 2001 From: BixbyCodes Date: Sun, 17 May 2026 03:06:17 +0530 Subject: [PATCH 2/3] Docs: add Javadoc to CoinChange class and method --- .../greedyalgorithms/CoinChange.java | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/thealgorithms/greedyalgorithms/CoinChange.java b/src/main/java/com/thealgorithms/greedyalgorithms/CoinChange.java index 8054581d21d7..a56361b4e5c6 100644 --- a/src/main/java/com/thealgorithms/greedyalgorithms/CoinChange.java +++ b/src/main/java/com/thealgorithms/greedyalgorithms/CoinChange.java @@ -6,10 +6,30 @@ // Problem Link : https://en.wikipedia.org/wiki/Change-making_problem +/** + * The Coin Change problem finds the minimum number of coins needed + * to make a given amount using a greedy approach. + * + *

Note: This greedy approach works optimally for standard coin systems + * (like Indian currency), but may not work for all arbitrary coin sets. + * For arbitrary denominations, dynamic programming is preferred. + * + * @see Change-making problem + */ public final class CoinChange { private CoinChange() { } - // Function to solve the coin change problem + + /** + * Returns the list of coins used to make the given amount + * using a greedy algorithm with standard denominations. + * + *

Time Complexity: O(n log n) where n is the number of coin denominations + *

Space Complexity: O(n) + * + * @param amount the total amount to make change for + * @return list of coins used to make the amount + */ public static ArrayList coinChangeProblem(int amount) { // Define an array of coin denominations in descending order Integer[] coins = {1, 2, 5, 10, 20, 50, 100, 500, 2000}; @@ -32,4 +52,4 @@ public static ArrayList coinChangeProblem(int amount) { } return ans; } -} +} \ No newline at end of file From d4db321b7825a016b5c8325741c0addb42a4d964 Mon Sep 17 00:00:00 2001 From: BixbyCodes Date: Sun, 17 May 2026 03:13:23 +0530 Subject: [PATCH 3/3] Style: apply clang-format to CoinChange.java --- .../java/com/thealgorithms/greedyalgorithms/CoinChange.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/thealgorithms/greedyalgorithms/CoinChange.java b/src/main/java/com/thealgorithms/greedyalgorithms/CoinChange.java index a56361b4e5c6..5f9f6080d0e1 100644 --- a/src/main/java/com/thealgorithms/greedyalgorithms/CoinChange.java +++ b/src/main/java/com/thealgorithms/greedyalgorithms/CoinChange.java @@ -52,4 +52,4 @@ public static ArrayList coinChangeProblem(int amount) { } return ans; } -} \ No newline at end of file +}