diff --git a/src/main/java/com/thealgorithms/datastructures/lists/DoublyLinkedList.java b/src/main/java/com/thealgorithms/datastructures/lists/DoublyLinkedList.java index 58898ddc0fcf..462521e464cc 100644 --- a/src/main/java/com/thealgorithms/datastructures/lists/DoublyLinkedList.java +++ b/src/main/java/com/thealgorithms/datastructures/lists/DoublyLinkedList.java @@ -7,7 +7,7 @@ *
* A linked list is similar to an array, it holds values. However, links in a
* linked list do not have indexes. With a linked list you do not need to
- * predetermine it's size as it grows and shrinks as it is edited. This is an
+ * predetermine its size as it grows and shrinks as it is edited. This is an
* example of a double ended, doubly linked list. Each link references the next
* link and the previous one.
*
diff --git a/src/main/java/com/thealgorithms/datastructures/lists/QuickSortLinkedList.java b/src/main/java/com/thealgorithms/datastructures/lists/QuickSortLinkedList.java
index f018781ada70..a7c2da913cd5 100644
--- a/src/main/java/com/thealgorithms/datastructures/lists/QuickSortLinkedList.java
+++ b/src/main/java/com/thealgorithms/datastructures/lists/QuickSortLinkedList.java
@@ -20,7 +20,7 @@
* List lessThanPivot : 3 -> 1 -> 2 -> 4
* List greaterThanPivot : 5 -> 8 -> 10 -> 7 -> 9 -> 6
*
- * -> reccur for lessThanPivot and greaterThanPivot
+ * -> recur for lessThanPivot and greaterThanPivot
*
* lessThanPivot :
* current pivot : 3
@@ -32,7 +32,7 @@
* lessThanPivot : null
* greaterThanPivot : 8 -> 10 -> 7 -> 9 -> 6
*
- * By following the above pattern, reccuring tree will form like below :
+ * By following the above pattern, the recursion tree will form like below :
*
* List-> 5 -> 3 -> 8 -> 1 -> 10 -> 2 -> 7 -> 4 -> 9 -> 6
*
@@ -66,7 +66,7 @@
* (N) (N) (N) (N)
*
*
- * -> After this the tree will reccur back (or backtrack)
+ * -> After this the tree will recur back (or backtrack)
* and the returning list from left and right subtree will attach
* themselves around pivot.
* i.e. ,
diff --git a/src/main/java/com/thealgorithms/datastructures/queues/PriorityQueues.java b/src/main/java/com/thealgorithms/datastructures/queues/PriorityQueues.java
index b877a5843b98..5d4157deef70 100644
--- a/src/main/java/com/thealgorithms/datastructures/queues/PriorityQueues.java
+++ b/src/main/java/com/thealgorithms/datastructures/queues/PriorityQueues.java
@@ -85,7 +85,7 @@ private void swim(int pos) {
private void sink(int pos) {
// Check if node's position is that of parent node
while (2 * pos <= nItems) {
- int current = 2 * pos; // Jump to the positon of child node
+ int current = 2 * pos; // Jump to the position of child node
// Compare both the children for the greater one
if (current < nItems && queueArray[current] < queueArray[current + 1]) {
current++;
diff --git a/src/main/java/com/thealgorithms/datastructures/trees/SegmentTree.java b/src/main/java/com/thealgorithms/datastructures/trees/SegmentTree.java
index af6acb0cbb2b..4fbb578dcf50 100644
--- a/src/main/java/com/thealgorithms/datastructures/trees/SegmentTree.java
+++ b/src/main/java/com/thealgorithms/datastructures/trees/SegmentTree.java
@@ -35,7 +35,7 @@ public final int constructTree(int[] arr, int start, int end, int index) {
return this.segTree[index];
}
- /* A function which will update the value at a index i. This will be called by the
+ /* A function which will update the value at an index i. This will be called by the
update function internally*/
private void updateTree(int start, int end, int index, int diff, int segIndex) {
if (index < start || index > end) {
diff --git a/src/main/java/com/thealgorithms/datastructures/trees/VerticalOrderTraversal.java b/src/main/java/com/thealgorithms/datastructures/trees/VerticalOrderTraversal.java
index c1d15390d4b9..5484b64641a9 100644
--- a/src/main/java/com/thealgorithms/datastructures/trees/VerticalOrderTraversal.java
+++ b/src/main/java/com/thealgorithms/datastructures/trees/VerticalOrderTraversal.java
@@ -73,7 +73,7 @@ public static ArrayList
* This may also do the job to read first time data (the whole buffer is empty)
*/
diff --git a/src/main/java/com/thealgorithms/maths/DigitalRoot.java b/src/main/java/com/thealgorithms/maths/DigitalRoot.java
index e8f5305c7569..c7367e5965df 100644
--- a/src/main/java/com/thealgorithms/maths/DigitalRoot.java
+++ b/src/main/java/com/thealgorithms/maths/DigitalRoot.java
@@ -55,7 +55,7 @@ public static int digitalRoot(int n) {
// This function is used for finding the sum of the digits of number
public static int single(int n) {
- if (n <= 9) { // if n becomes less than 10 than return n
+ if (n <= 9) { // if n becomes less than 10 then return n
return n;
} else {
return (n % 10) + single(n / 10); // n % 10 for extracting digits one by one
diff --git a/src/main/java/com/thealgorithms/maths/EvilNumber.java b/src/main/java/com/thealgorithms/maths/EvilNumber.java
index 419133702fd4..a10794fb5a85 100644
--- a/src/main/java/com/thealgorithms/maths/EvilNumber.java
+++ b/src/main/java/com/thealgorithms/maths/EvilNumber.java
@@ -26,7 +26,7 @@ private static int countOneBits(int number) {
* Check either {@code number} is an Evil number or Odious number
*
* @param number the number
- * @return {@code true} if {@code number} is an Evil number, otherwise false (in case of of Odious number)
+ * @return {@code true} if {@code number} is an Evil number, otherwise false (in case of Odious number)
*/
public static boolean isEvilNumber(int number) {
if (number < 0) {
diff --git a/src/main/java/com/thealgorithms/maths/MathBuilder.java b/src/main/java/com/thealgorithms/maths/MathBuilder.java
index 1cf3d8b7fc9a..08d2ae2c9456 100644
--- a/src/main/java/com/thealgorithms/maths/MathBuilder.java
+++ b/src/main/java/com/thealgorithms/maths/MathBuilder.java
@@ -481,8 +481,8 @@ public Builder closeParenthesisAndDivide() {
}
public Builder format(String format) {
- DecimalFormat formater = new DecimalFormat(format);
- String num = formater.format(number);
+ DecimalFormat formatter = new DecimalFormat(format);
+ String num = formatter.format(number);
number = Double.parseDouble(num);
return this;
}
@@ -490,8 +490,8 @@ public Builder format(String format) {
public Builder format(int decimalPlace) {
String pattern = "."
+ "#".repeat(decimalPlace);
- DecimalFormat formater = new DecimalFormat(pattern);
- String num = formater.format(number);
+ DecimalFormat formatter = new DecimalFormat(pattern);
+ String num = formatter.format(number);
number = Double.parseDouble(num);
return this;
}
diff --git a/src/main/java/com/thealgorithms/maths/PollardRho.java b/src/main/java/com/thealgorithms/maths/PollardRho.java
index 7fa913b21b7e..c63f93d839bf 100644
--- a/src/main/java/com/thealgorithms/maths/PollardRho.java
+++ b/src/main/java/com/thealgorithms/maths/PollardRho.java
@@ -54,7 +54,7 @@ static int g(int base, int modulus) {
/**
* This method returns a non-trivial factor of given integer number
*
- * @param number Integer is a integer value whose non-trivial factor is to be found
+ * @param number Integer is an integer value whose non-trivial factor is to be found
* @return Integer non-trivial factor of number
* @throws RuntimeException object if GCD of given number cannot be found
*/
diff --git a/src/main/java/com/thealgorithms/maths/VectorCrossProduct.java b/src/main/java/com/thealgorithms/maths/VectorCrossProduct.java
index e2769744bcda..41bbbb077c68 100644
--- a/src/main/java/com/thealgorithms/maths/VectorCrossProduct.java
+++ b/src/main/java/com/thealgorithms/maths/VectorCrossProduct.java
@@ -15,7 +15,7 @@
* matrix consisting of the first row with unit vectors of magnitude 1, the
* second row with the direction ratios of the first vector and the third row
* with the direction ratios of the second vector. The magnitude of a vector is
- * it's value expressed as a number. Let the direction ratios of the first
+ * its value expressed as a number. Let the direction ratios of the first
* vector, P be: a, b, c Let the direction ratios of the second vector, Q be: x,
* y, z Therefore the calculation for the cross product can be arranged as:
*
diff --git a/src/main/java/com/thealgorithms/others/ArrayRightRotation.java b/src/main/java/com/thealgorithms/others/ArrayRightRotation.java
index 125edadb6e73..ba80f29af710 100644
--- a/src/main/java/com/thealgorithms/others/ArrayRightRotation.java
+++ b/src/main/java/com/thealgorithms/others/ArrayRightRotation.java
@@ -34,7 +34,7 @@ public static int[] rotateRight(int[] arr, int k) {
}
/**
- * Performs reversing of a array
+ * Performs reversing of an array
* @param arr the array to be reversed
* @param start starting position
* @param end ending position
diff --git a/src/main/java/com/thealgorithms/others/Damm.java b/src/main/java/com/thealgorithms/others/Damm.java
index 55a4c5b81a89..c6365ada42f7 100644
--- a/src/main/java/com/thealgorithms/others/Damm.java
+++ b/src/main/java/com/thealgorithms/others/Damm.java
@@ -60,7 +60,7 @@ public static boolean dammCheck(String digits) {
}
/**
- * Calculate check digit for initial digits and add it tho the last
+ * Calculate check digit for initial digits and add it to the last
* position.
*
* @param initialDigits initial value
diff --git a/src/main/java/com/thealgorithms/others/PasswordGen.java b/src/main/java/com/thealgorithms/others/PasswordGen.java
index da9f21bc918f..4f139963eae5 100644
--- a/src/main/java/com/thealgorithms/others/PasswordGen.java
+++ b/src/main/java/com/thealgorithms/others/PasswordGen.java
@@ -41,7 +41,7 @@ public static String generatePassword(int minLength, int maxLength) {
letters.add(c);
}
- // Inbuilt method to randomly shuffle a elements of a list
+ // Inbuilt method to randomly shuffle the elements of a list
Collections.shuffle(letters);
StringBuilder password = new StringBuilder();
diff --git a/src/main/java/com/thealgorithms/others/Verhoeff.java b/src/main/java/com/thealgorithms/others/Verhoeff.java
index 9088612aaa43..bd25113f494f 100644
--- a/src/main/java/com/thealgorithms/others/Verhoeff.java
+++ b/src/main/java/com/thealgorithms/others/Verhoeff.java
@@ -108,7 +108,7 @@ public static boolean verhoeffCheck(String digits) {
}
/**
- * Calculate check digit for initial digits and add it tho the last
+ * Calculate check digit for initial digits and add it to the last
* position.
*
* @param initialDigits initial value
diff --git a/src/main/java/com/thealgorithms/sorts/LinkListSort.java b/src/main/java/com/thealgorithms/sorts/LinkListSort.java
index d8fd76a86236..4af789f1e460 100644
--- a/src/main/java/com/thealgorithms/sorts/LinkListSort.java
+++ b/src/main/java/com/thealgorithms/sorts/LinkListSort.java
@@ -13,7 +13,7 @@ public static boolean isSorted(int[] p, int option) {
int[] b = p;
// array similar to a
int ch = option;
- // Choice is choosed as any number from 1 to 3 (So the linked list will be
+ // Choice is chosen as any number from 1 to 3 (So the linked list will be
// sorted by Merge sort technique/Insertion sort technique/Heap sort technique)
switch (ch) {
case 1:
@@ -176,7 +176,7 @@ int count(Node head) {
}
return c;
// This Method is used to count number of elements/nodes present in the linklist
- // It will return a integer type value denoting the number of nodes present
+ // It will return an integer type value denoting the number of nodes present
}
void task(int[] n, int i, int j) {
@@ -252,7 +252,7 @@ static int count(Node head) {
}
return c;
// This Method is used to count number of elements/nodes present in the linklist
- // It will return a integer type value denoting the number of nodes present
+ // It will return an integer type value denoting the number of nodes present
}
// The method task and task1 is used to sort the linklist using insertion sort
}
@@ -288,7 +288,7 @@ int count(Node head) {
}
return c;
// This Method is used to count number of elements/nodes present in the linklist
- // It will return a integer type value denoting the number of nodes present
+ // It will return an integer type value denoting the number of nodes present
}
void task(int[] n) {
diff --git a/src/main/java/com/thealgorithms/strings/zigZagPattern/README.md b/src/main/java/com/thealgorithms/strings/zigZagPattern/README.md
index 17e5ba6e26d8..a8689351f359 100644
--- a/src/main/java/com/thealgorithms/strings/zigZagPattern/README.md
+++ b/src/main/java/com/thealgorithms/strings/zigZagPattern/README.md
@@ -22,14 +22,14 @@ for example :
# working
if string size is smaller than numRows or numRows is smaller than 2
- than we can return string because it will make no changes to string.
+ then we can return string because it will make no changes to string.
If not than
we initiate three variable depth which is equalvalent to numRows ,
height which starts with 1 and start with starting index of string.
- than we generate spaces to skip using formula 2 + (( n - 1 ) * 2 )
+ then we generate spaces to skip using formula 2 + (( n - 1 ) * 2 )
for both height and depth
- with each iteration we decrement depth and increate height and start
- by one also we keep contantating character on to new string with first
+ with each iteration we decrement depth and increase height and start
+ by one also we keep concatenating character on to new string with first
depth spaces and later height spaces that we generated using formula
if not zero
diff --git a/src/test/java/com/thealgorithms/graph/HierholzerEulerianPathTest.java b/src/test/java/com/thealgorithms/graph/HierholzerEulerianPathTest.java
index 612d09561b7b..e6a35566c587 100644
--- a/src/test/java/com/thealgorithms/graph/HierholzerEulerianPathTest.java
+++ b/src/test/java/com/thealgorithms/graph/HierholzerEulerianPathTest.java
@@ -153,7 +153,7 @@ void testMultipleEdgesBetweenSameNodes() {
HierholzerEulerianPath solver = new HierholzerEulerianPath(graph);
List