Skip to content

Commit 6ed9243

Browse files
authored
docs: fix typos in comments (#7616)
* docs: fix typos in comments Fix misspellings found with codespell: reccur/reccuring, positon, choosed, increate, contantating, and "Hava a Eulerian Path". Also rename the local variable formater to formatter in MathBuilder. * docs: fix grammar typos in comments Fix "tho" -> "to", doubled "of of", "than" -> "then", "it's" -> "its", "in-order to" -> "in order to", and "a" -> "an" before vowel sounds.
1 parent dd8df80 commit 6ed9243

18 files changed

Lines changed: 29 additions & 29 deletions

‎src/main/java/com/thealgorithms/datastructures/lists/DoublyLinkedList.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* <p>
88
* A linked list is similar to an array, it holds values. However, links in a
99
* linked list do not have indexes. With a linked list you do not need to
10-
* predetermine it's size as it grows and shrinks as it is edited. This is an
10+
* predetermine its size as it grows and shrinks as it is edited. This is an
1111
* example of a double ended, doubly linked list. Each link references the next
1212
* link and the previous one.
1313
*

‎src/main/java/com/thealgorithms/datastructures/lists/QuickSortLinkedList.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* List lessThanPivot : 3 -> 1 -> 2 -> 4
2121
* List greaterThanPivot : 5 -> 8 -> 10 -> 7 -> 9 -> 6
2222
*
23-
* -> reccur for lessThanPivot and greaterThanPivot
23+
* -> recur for lessThanPivot and greaterThanPivot
2424
*
2525
* lessThanPivot :
2626
* current pivot : 3
@@ -32,7 +32,7 @@
3232
* lessThanPivot : null
3333
* greaterThanPivot : 8 -> 10 -> 7 -> 9 -> 6
3434
*
35-
* By following the above pattern, reccuring tree will form like below :
35+
* By following the above pattern, the recursion tree will form like below :
3636
*
3737
* List-> 5 -> 3 -> 8 -> 1 -> 10 -> 2 -> 7 -> 4 -> 9 -> 6
3838
*
@@ -66,7 +66,7 @@
6666
* (N) (N) (N) (N)
6767
*
6868
*
69-
* -> After this the tree will reccur back (or backtrack)
69+
* -> After this the tree will recur back (or backtrack)
7070
* and the returning list from left and right subtree will attach
7171
* themselves around pivot.
7272
* i.e. ,

‎src/main/java/com/thealgorithms/datastructures/queues/PriorityQueues.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ private void swim(int pos) {
8585
private void sink(int pos) {
8686
// Check if node's position is that of parent node
8787
while (2 * pos <= nItems) {
88-
int current = 2 * pos; // Jump to the positon of child node
88+
int current = 2 * pos; // Jump to the position of child node
8989
// Compare both the children for the greater one
9090
if (current < nItems && queueArray[current] < queueArray[current + 1]) {
9191
current++;

‎src/main/java/com/thealgorithms/datastructures/trees/SegmentTree.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public final int constructTree(int[] arr, int start, int end, int index) {
3535
return this.segTree[index];
3636
}
3737

38-
/* A function which will update the value at a index i. This will be called by the
38+
/* A function which will update the value at an index i. This will be called by the
3939
update function internally*/
4040
private void updateTree(int start, int end, int index, int diff, int segIndex) {
4141
if (index < start || index > end) {

‎src/main/java/com/thealgorithms/datastructures/trees/VerticalOrderTraversal.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public static ArrayList<Integer> verticalTraversal(BinaryTree.Node root) {
7373
ArrayList<Integer> a = new ArrayList<>();
7474
map.put(index.peek(), a);
7575
}
76-
/*For a index, corresponding Node data is added
76+
/*For an index, corresponding Node data is added
7777
to the respective ArrayList present at that
7878
index. */
7979
map.get(index.peek()).add(queue.peek().data);

‎src/main/java/com/thealgorithms/io/BufferedReader.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public int peek(int n) throws IOException {
108108

109109
/**
110110
* Removes the already read bytes from the buffer
111-
* in-order to make space for new bytes to be filled up.
111+
* in order to make space for new bytes to be filled up.
112112
* <p>
113113
* This may also do the job to read first time data (the whole buffer is empty)
114114
*/

‎src/main/java/com/thealgorithms/maths/DigitalRoot.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public static int digitalRoot(int n) {
5555

5656
// This function is used for finding the sum of the digits of number
5757
public static int single(int n) {
58-
if (n <= 9) { // if n becomes less than 10 than return n
58+
if (n <= 9) { // if n becomes less than 10 then return n
5959
return n;
6060
} else {
6161
return (n % 10) + single(n / 10); // n % 10 for extracting digits one by one

‎src/main/java/com/thealgorithms/maths/EvilNumber.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ private static int countOneBits(int number) {
2626
* Check either {@code number} is an Evil number or Odious number
2727
*
2828
* @param number the number
29-
* @return {@code true} if {@code number} is an Evil number, otherwise false (in case of of Odious number)
29+
* @return {@code true} if {@code number} is an Evil number, otherwise false (in case of Odious number)
3030
*/
3131
public static boolean isEvilNumber(int number) {
3232
if (number < 0) {

‎src/main/java/com/thealgorithms/maths/MathBuilder.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -481,17 +481,17 @@ public Builder closeParenthesisAndDivide() {
481481
}
482482

483483
public Builder format(String format) {
484-
DecimalFormat formater = new DecimalFormat(format);
485-
String num = formater.format(number);
484+
DecimalFormat formatter = new DecimalFormat(format);
485+
String num = formatter.format(number);
486486
number = Double.parseDouble(num);
487487
return this;
488488
}
489489

490490
public Builder format(int decimalPlace) {
491491
String pattern = "."
492492
+ "#".repeat(decimalPlace);
493-
DecimalFormat formater = new DecimalFormat(pattern);
494-
String num = formater.format(number);
493+
DecimalFormat formatter = new DecimalFormat(pattern);
494+
String num = formatter.format(number);
495495
number = Double.parseDouble(num);
496496
return this;
497497
}

‎src/main/java/com/thealgorithms/maths/PollardRho.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ static int g(int base, int modulus) {
5454
/**
5555
* This method returns a non-trivial factor of given integer number
5656
*
57-
* @param number Integer is a integer value whose non-trivial factor is to be found
57+
* @param number Integer is an integer value whose non-trivial factor is to be found
5858
* @return Integer non-trivial factor of number
5959
* @throws RuntimeException object if GCD of given number cannot be found
6060
*/

0 commit comments

Comments
 (0)