diff --git a/src/main/java/com/thealgorithms/backtracking/ParenthesesGenerator.java b/src/main/java/com/thealgorithms/backtracking/ParenthesesGenerator.java index 8bbed410..bf93f946 100644 --- a/src/main/java/com/thealgorithms/backtracking/ParenthesesGenerator.java +++ b/src/main/java/com/thealgorithms/backtracking/ParenthesesGenerator.java @@ -19,7 +19,7 @@ public final class ParenthesesGenerator { */ public static List generateParentheses(final int n) { if (n < 0) { - throw new IllegalArgumentException("The number of pairs of parentheses cannot be nagative"); + throw new IllegalArgumentException("The number of pairs of parentheses cannot be negative"); } List result = new ArrayList<>(); generateParenthesesHelper(result, "", 0, 0, n); diff --git a/src/main/java/com/thealgorithms/datastructures/trees/BSTRecursive.java b/src/main/java/com/thealgorithms/datastructures/trees/BSTRecursive.java index 4e24f4bf..6c1f4f67 100644 --- a/src/main/java/com/thealgorithms/datastructures/trees/BSTRecursive.java +++ b/src/main/java/com/thealgorithms/datastructures/trees/BSTRecursive.java @@ -95,7 +95,7 @@ public class BSTRecursive { } /** - * Serach recursively if the given value is present in BST or not. + * Search recursively if the given value is present in BST or not. * * @param node the current node to check * @param data the value to be checked diff --git a/src/main/java/com/thealgorithms/misc/PalindromePrime.java b/src/main/java/com/thealgorithms/misc/PalindromePrime.java index 6b01cdce..e1cbf3ff 100644 --- a/src/main/java/com/thealgorithms/misc/PalindromePrime.java +++ b/src/main/java/com/thealgorithms/misc/PalindromePrime.java @@ -6,7 +6,7 @@ public final class PalindromePrime { private PalindromePrime() { } - public static void main(String[] args) { // Main funtion + public static void main(String[] args) { // Main function Scanner in = new Scanner(System.in); System.out.println("Enter the quantity of First Palindromic Primes you want"); int n = in.nextInt(); // Input of how many first palindromic prime we want diff --git a/src/main/java/com/thealgorithms/searches/HowManyTimesRotated.java b/src/main/java/com/thealgorithms/searches/HowManyTimesRotated.java index 8e601f98..dd01378f 100644 --- a/src/main/java/com/thealgorithms/searches/HowManyTimesRotated.java +++ b/src/main/java/com/thealgorithms/searches/HowManyTimesRotated.java @@ -17,7 +17,7 @@ import java.util.Scanner; from its initial sorted position. Eg. For [2,5,6,8,11,12,15,18], 1 rotation gives [5,6,8,11,12,15,18,2], 2 rotations [6,8,11,12,15,18,2,5] and so on. Finding the minimum element will take O(N) time but, we can use - Binary Search to find the mimimum element, we can reduce the complexity to O(log N). If we look + Binary Search to find the minimum element, we can reduce the complexity to O(log N). If we look at the rotated array, to identify the minimum element (say a[i]), we observe that a[i-1]>a[i]