Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* <p>
* 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.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
*
Expand Down Expand Up @@ -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. ,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public static ArrayList<Integer> verticalTraversal(BinaryTree.Node root) {
ArrayList<Integer> a = new ArrayList<>();
map.put(index.peek(), a);
}
/*For a index, corresponding Node data is added
/*For an index, corresponding Node data is added
to the respective ArrayList present at that
index. */
map.get(index.peek()).add(queue.peek().data);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/thealgorithms/io/BufferedReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public int peek(int n) throws IOException {

/**
* Removes the already read bytes from the buffer
* in-order to make space for new bytes to be filled up.
* in order to make space for new bytes to be filled up.
* <p>
* This may also do the job to read first time data (the whole buffer is empty)
*/
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/thealgorithms/maths/DigitalRoot.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/thealgorithms/maths/EvilNumber.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/com/thealgorithms/maths/MathBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -481,17 +481,17 @@ 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;
}

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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/thealgorithms/maths/PollardRho.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/thealgorithms/others/Damm.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/thealgorithms/others/PasswordGen.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/thealgorithms/others/Verhoeff.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/com/thealgorithms/sorts/LinkListSort.java
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ void testMultipleEdgesBetweenSameNodes() {
HierholzerEulerianPath solver = new HierholzerEulerianPath(graph);
List<Integer> result = solver.findEulerianPath();

// Hava a Eulerian Path but not a Eulerian Circuit
// Has an Eulerian Path but not an Eulerian Circuit
assertEquals(result, Arrays.asList(0, 1, 2, 0, 1));
}

Expand Down
Loading