Skip to content

Commit cc9afea

Browse files
RANJEETJ06Ranjeet Kumar Jenasiriak
authored
Fix formatting (TheAlgorithms#4259)
Co-authored-by: Ranjeet Kumar Jena <[email protected]> Co-authored-by: Andrii Siriak <[email protected]>
1 parent de50fc0 commit cc9afea

8 files changed

+21
-21
lines changed

src/main/java/com/thealgorithms/datastructures/trees/BSTIterative.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
* <p>
1111
* An implementation of BST iteratively. Binary Search Tree is a binary tree
1212
* which satisfies three properties: left child is less than root node, right
13-
* child is grater than root node, both left and right childs must themselves be
13+
* child is grater than root node, both left and right child must themselves be
1414
* a BST.
1515
*
16-
* @author [Lakhan Nad](https://github.com/Lakhan-Nad)
16+
* @author [Lakhan Nad](<a href="https://github.com/Lakhan-Nad">git-Lakhan Nad</a>)
1717
*/
1818

1919
public class BSTIterative {

src/main/java/com/thealgorithms/datastructures/trees/BSTRecursive.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* I have made public functions as methods and to actually implement recursive
1818
* approach I have used private methods
1919
*
20-
* @author [Lakhan Nad](https://github.com/Lakhan-Nad)
20+
* @author [Lakhan Nad](<a href="https://github.com/Lakhan-Nad">git-Lakhan Nad</a>)
2121
*/
2222
public class BSTRecursive {
2323

src/main/java/com/thealgorithms/datastructures/trees/BSTRecursiveGeneric.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
* <p>
1010
* A recursive implementation of generic type BST.
1111
*
12-
* Reference: https://en.wikipedia.org/wiki/Binary_search_tree
12+
* Reference: <a href="https://en.wikipedia.org/wiki/Binary_search_tree">Wiki links for BST</a>
1313
* </p>
1414
*
15-
* @author [Madhur Panwar](https://github.com/mdrpanwar)
15+
* @author [Madhur Panwar](<a href="https://github.com/mdrpanwar">git-Madhur Panwar</a>)
1616
*/
1717
public class BSTRecursiveGeneric<T extends Comparable<T>> {
1818

@@ -219,7 +219,7 @@ private void inOrderSort(Node<T> node, List<T> sortedList) {
219219
}
220220

221221
/**
222-
* Serach recursively if the given value is present in BST or not.
222+
* Search recursively if the given value is present in BST or not.
223223
*
224224
* @param node the node under which to check
225225
* @param data the value to be checked

src/main/java/com/thealgorithms/datastructures/trees/CeilInBinarySearchTree.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
* ii) If key is lesser than root value than ceil will be in right subtree so
4040
* call recursively on right subtree iii) if key is greater than current root,
4141
* then either a) the root is ceil b) ceil is in left subtree: call for left
42-
* subtree. If left subtree returns a non null value then that will be ceil
42+
* subtree. If left subtree returns a non-null value then that will be ceil
4343
* otherwise the root is ceil
4444
*/
4545
public class CeilInBinarySearchTree {

src/main/java/com/thealgorithms/datastructures/trees/CheckIfBinaryTreeBalanced.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* `isBalancedRecursive()` is implemented in a recursive fashion, and
1313
* `isBalancedIterative()` is implemented in an iterative fashion.
1414
*
15-
* @author [Ian Cowan](https://github.com/iccowan)
15+
* @author [Ian Cowan](<a href="https://github.com/iccowan">Git-Ian Cowan</a>)
1616
*/
1717
public class CheckIfBinaryTreeBalanced {
1818
/**

src/main/java/com/thealgorithms/datastructures/trees/CheckTreeIsSymmetric.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,16 @@ public static boolean isSymmetric(Node root) {
3939
return isSymmetric(root.left, root.right);
4040
}
4141

42-
private static boolean isSymmetric(Node leftSubtreeRoot, Node rightSubtreRoot) {
43-
if (leftSubtreeRoot == null && rightSubtreRoot == null) {
42+
private static boolean isSymmetric(Node leftSubtreeRoot, Node rightSubtreeRoot) {
43+
if (leftSubtreeRoot == null && rightSubtreeRoot == null) {
4444
return true;
4545
}
4646

47-
if (isInvalidSubtree(leftSubtreeRoot, rightSubtreRoot)) {
47+
if (isInvalidSubtree(leftSubtreeRoot, rightSubtreeRoot)) {
4848
return false;
4949
}
5050

51-
return isSymmetric(leftSubtreeRoot.right, rightSubtreRoot.left) && isSymmetric(leftSubtreeRoot.left, rightSubtreRoot.right);
51+
return isSymmetric(leftSubtreeRoot.right, rightSubtreeRoot.left) && isSymmetric(leftSubtreeRoot.left, rightSubtreeRoot.right);
5252
}
5353

5454
private static boolean isInvalidSubtree(Node leftSubtreeRoot, Node rightSubtreeRoot) {

src/main/java/com/thealgorithms/datastructures/trees/GenericTree.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,32 +16,32 @@
1616
*/
1717
public class GenericTree {
1818

19-
private class Node {
19+
private static class Node {
2020

2121
int data;
2222
ArrayList<Node> child = new ArrayList<>();
2323
}
2424

25-
private Node root;
25+
private final Node root;
2626
public GenericTree() { // Constructor
2727
Scanner scn = new Scanner(System.in);
2828
root = create_treeG(null, 0, scn);
2929
}
3030

31-
private Node create_treeG(Node node, int childindx, Scanner scn) {
31+
private Node create_treeG(Node node, int childIndex, Scanner scanner) {
3232
// display
3333
if (node == null) {
3434
System.out.println("Enter root's data");
3535
} else {
36-
System.out.println("Enter data of parent of index " + node.data + " " + childindx);
36+
System.out.println("Enter data of parent of index " + node.data + " " + childIndex);
3737
}
3838
// input
3939
node = new Node();
40-
node.data = scn.nextInt();
40+
node.data = scanner.nextInt();
4141
System.out.println("number of children");
42-
int number = scn.nextInt();
42+
int number = scanner.nextInt();
4343
for (int i = 0; i < number; i++) {
44-
Node child = create_treeG(node, i, scn);
44+
Node child = create_treeG(node, i, scanner);
4545
node.child.add(child);
4646
}
4747
return node;

src/main/java/com/thealgorithms/datastructures/trees/LCA.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
public class LCA {
77

8-
private static Scanner scanner = new Scanner(System.in);
8+
private static final Scanner scanner = new Scanner(System.in);
99

1010
public static void main(String[] args) {
1111
// The adjacency list representation of a tree:
@@ -91,7 +91,7 @@ private static int getLCA(int v1, int v2, int[] depth, int[] parent) {
9191
return v1;
9292
}
9393
}
94-
/**
94+
/*
9595
* Input:
9696
* 10
9797
* 0 1

0 commit comments

Comments
 (0)