From 1f3748a3381f35e28d55475874977a1831a063d6 Mon Sep 17 00:00:00 2001
From: CareerMonk <narkarum@in.ibm.com>
Date: Thu, 15 Jun 2017 11:18:30 +0530
Subject: [PATCH 01/19] New Problems

New Problems
---
 src/chapter01introduction/Variables.py   | 17 ++++++++++++++
 src/chapter01introduction/Variables2.py  |  8 +++++++
 src/chapter21miscconcepts/RegexDemo.java | 29 ++++++++++++++++++++++++
 3 files changed, 54 insertions(+)
 create mode 100644 src/chapter01introduction/Variables.py
 create mode 100644 src/chapter01introduction/Variables2.py
 create mode 100644 src/chapter21miscconcepts/RegexDemo.java

diff --git a/src/chapter01introduction/Variables.py b/src/chapter01introduction/Variables.py
new file mode 100644
index 0000000..5f54b5d
--- /dev/null
+++ b/src/chapter01introduction/Variables.py
@@ -0,0 +1,17 @@
+# your code goes here#Assign x to a Integer
+x = 5
+print "The value of x is:", x
+print "The type of x is:", type(x)
+print "The memory location of x is:", id(x)
+
+#Assign x to a Float
+x = 6.5
+print "The value of x is:", x
+print "The type of x is:", type(x)
+print "The memory location of x is:", id(x)
+
+#Assign x to a String
+x = "CodingDucks.org"
+print "The value of x is:", x
+print "The type of x is:", type(x)
+print "The memory location of x is:", id(x) 
diff --git a/src/chapter01introduction/Variables2.py b/src/chapter01introduction/Variables2.py
new file mode 100644
index 0000000..6d1d6ef
--- /dev/null
+++ b/src/chapter01introduction/Variables2.py
@@ -0,0 +1,8 @@
+x = 5
+print "Memory location of x:",id(x)
+
+x = 6
+print "Memory location of x:",id(x)
+
+y = 5
+print "Memory location of y:",id(y)
diff --git a/src/chapter21miscconcepts/RegexDemo.java b/src/chapter21miscconcepts/RegexDemo.java
new file mode 100644
index 0000000..8e6a85f
--- /dev/null
+++ b/src/chapter21miscconcepts/RegexDemo.java
@@ -0,0 +1,29 @@
+import java.util.regex.*;
+
+class RegexDemo{
+	public static void main (String[] args) throws java.lang.Exception{
+		//matches numbers only
+		String regexStr = "^[0-9]*$";
+		System.out.println(Pattern.matches(regexStr,"97845613000"));
+		System.out.println(Pattern.matches(regexStr,"19432"));
+		System.out.println(Pattern.matches(regexStr,"519Ah"));
+
+		//matches 10-digit numbers only
+		regexStr = "^[0-9]{10}$";
+		System.out.println(Pattern.matches(regexStr,"6576767"));
+		System.out.println(Pattern.matches(regexStr,"9784561300"));
+		System.out.println(Pattern.matches(regexStr,"F784561300"));
+
+		//matches numbers and dashes, any order really.
+		regexStr = "^[0-9\\-]*$";
+		System.out.println(Pattern.matches(regexStr,"97-8456-13-0-0"));
+		System.out.println(Pattern.matches(regexStr,"9-7-8-4-5-6-1-3-0-0"));
+
+		//matches 9999999999, 1-999-999-9999 and 999-999-9999
+		regexStr = "^(1\\-)?[0-9]{3}\\-?[0-9]{3}\\-?[0-9]{4}$";
+		System.out.println(Pattern.matches(regexStr,"9784561300"));
+		System.out.println(Pattern.matches(regexStr,"9-784561300"));
+		System.out.println(Pattern.matches(regexStr,"978-456-1300"));
+		System.out.println(Pattern.matches(regexStr,"97-8456-13-0-0"));
+	}
+}

From 4ad6d93c5fa69b2cbc52d16e06d841f56f839f45 Mon Sep 17 00:00:00 2001
From: CareerMonk <narkarum@in.ibm.com>
Date: Sun, 18 Jun 2017 16:55:25 +0530
Subject: [PATCH 02/19] New Problems

---
 .../All_PeakFinder_1D_Linear_Search.java      | 28 +++++++++++++++
 .../Highest_PeakFinder_1D_Linear_Search.java  | 27 ++++++++++++++
 .../PeakFinder_1D_Binary_Search.java          | 35 +++++++++++++++++++
 .../PeakFinder_1D_Linear_Search.java          | 28 +++++++++++++++
 4 files changed, 118 insertions(+)
 create mode 100644 src/chapter18divideandconquer/All_PeakFinder_1D_Linear_Search.java
 create mode 100644 src/chapter18divideandconquer/Highest_PeakFinder_1D_Linear_Search.java
 create mode 100644 src/chapter18divideandconquer/PeakFinder_1D_Binary_Search.java
 create mode 100644 src/chapter18divideandconquer/PeakFinder_1D_Linear_Search.java

diff --git a/src/chapter18divideandconquer/All_PeakFinder_1D_Linear_Search.java b/src/chapter18divideandconquer/All_PeakFinder_1D_Linear_Search.java
new file mode 100644
index 0000000..2c52c62
--- /dev/null
+++ b/src/chapter18divideandconquer/All_PeakFinder_1D_Linear_Search.java
@@ -0,0 +1,28 @@
+public class All_PeakFinder_1D_Linear_Search{
+
+  public static void findPeak(int[] A) {
+
+    if (A == null || A.length == 0) {
+      return;
+    }
+    int n = A.length;
+
+    for (int i = 0; i < n; i++){
+      int left = 0, right = 0;
+      if (i > 0){
+        left = A[i - 1];
+      }
+      if (i < A.length - 1){
+        right = A[i + 1];
+      }
+      if (left <= A[i] && A[i] >= right){
+        System.out.println(A[i] + "");
+      }
+  	}
+  }
+
+public static void main(String[] args) {
+    int[] A = { 35, 5, 20, 2, 40, 25, 80, 25, 15, 40 };
+    findPeak(A);
+  }
+}
diff --git a/src/chapter18divideandconquer/Highest_PeakFinder_1D_Linear_Search.java b/src/chapter18divideandconquer/Highest_PeakFinder_1D_Linear_Search.java
new file mode 100644
index 0000000..90477e4
--- /dev/null
+++ b/src/chapter18divideandconquer/Highest_PeakFinder_1D_Linear_Search.java
@@ -0,0 +1,27 @@
+public class Highest_PeakFinder_1D_Linear_Search{
+
+  public static Integer findPeak(int[] A) {
+
+    if (A == null || A.length == 0) {
+      return null;
+    }
+
+    int n = A.length;
+    int peak = A[0];
+    for (int i = 1; i < n-1; i++){
+      if (A[i - 1] <= A[i] && A[i] >= A[i + 1]){
+        peak = A[i];
+      }
+  	}
+    if (peak < A[A.length-1]){
+      peak = A[A.length-1];
+    }
+    return peak;
+  }
+
+public static void main(String[] args) {
+    int[] A = { 35, 5, 20, 2, 40, 25, 80, 25, 15, 40 };
+    Integer peak = findPeak(A);
+    System.out.println(peak != null ? "Peak Element is "  + peak : "No peak element!" );
+  }
+}
diff --git a/src/chapter18divideandconquer/PeakFinder_1D_Binary_Search.java b/src/chapter18divideandconquer/PeakFinder_1D_Binary_Search.java
new file mode 100644
index 0000000..c39d018
--- /dev/null
+++ b/src/chapter18divideandconquer/PeakFinder_1D_Binary_Search.java
@@ -0,0 +1,35 @@
+public class PeakFinder_1D_Binary_Search{
+
+  public static Integer findPeak(int[] A) {
+    if (A == null || A.length == 0) {
+      return null;
+    }
+
+    int left = 0, right = A.length - 1, mid;
+    while (left + 1 < right){
+      mid = left + (right - left) / 2;
+      if (A[mid] < A[mid - 1]){
+        right = mid;
+      }
+      else if (A[mid] < A[mid + 1]){
+        left = mid;
+      }
+      else{
+        return mid;
+      }
+    }
+    if (A[left] > A[right]){
+      mid = left;
+    }
+    else{
+      mid = right;
+    }
+    return mid;
+  }
+
+public static void main(String[] args) {
+  int[] A = { 35, 5, 20, 2, 40, 25, 80, 25, 15, 40 };
+  Integer peak = findPeak(A);
+  System.out.println(peak != null ? "Peak Element is "  + A[peak] : "No peak element!" );
+  }
+}
diff --git a/src/chapter18divideandconquer/PeakFinder_1D_Linear_Search.java b/src/chapter18divideandconquer/PeakFinder_1D_Linear_Search.java
new file mode 100644
index 0000000..af56834
--- /dev/null
+++ b/src/chapter18divideandconquer/PeakFinder_1D_Linear_Search.java
@@ -0,0 +1,28 @@
+public class PeakFinder_1D_Linear_Search{
+
+  public static Integer findPeak(int[] A) {
+
+    if (A == null || A.length == 0) {
+      return null;
+    }
+
+    int n = A.length;
+    int peak = A[0];
+    for (int i = 1; i < n; i++){
+      if (A[i - 1] <= A[i] && A[i] >= A[i + 1]){
+        peak = A[i];
+        return peak;
+      }
+  	}
+    if (peak < A[A.length-1]){
+      peak = A[A.length-1];
+    }
+    return null;
+  }
+
+public static void main(String[] args) {
+    int[] A = { 35, 5, 20, 2, 40, 25, 80, 25, 15, 40 };
+    Integer peak = findPeak(A);
+    System.out.println(peak != null ? "Peak Element is "  + peak : "No peak element!" );
+  }
+}

From d02166ccdfc1cccc7975e2664c3a3e9763022d83 Mon Sep 17 00:00:00 2001
From: Kiran Hegde <kiran.hegde@staples.com>
Date: Thu, 9 Nov 2017 18:40:17 -0500
Subject: [PATCH 03/19] Minor fixes

---
 .../All_PeakFinder_1D_Linear_Search.java                        | 2 ++
 .../Highest_PeakFinder_1D_Linear_Search.java                    | 2 ++
 src/chapter18divideandconquer/PeakFinder_1D_Binary_Search.java  | 1 +
 src/chapter18divideandconquer/PeakFinder_1D_Linear_Search.java  | 2 ++
 4 files changed, 7 insertions(+)

diff --git a/src/chapter18divideandconquer/All_PeakFinder_1D_Linear_Search.java b/src/chapter18divideandconquer/All_PeakFinder_1D_Linear_Search.java
index 2c52c62..9870910 100644
--- a/src/chapter18divideandconquer/All_PeakFinder_1D_Linear_Search.java
+++ b/src/chapter18divideandconquer/All_PeakFinder_1D_Linear_Search.java
@@ -1,3 +1,5 @@
+package chapter18divideandconquer;
+
 public class All_PeakFinder_1D_Linear_Search{
 
   public static void findPeak(int[] A) {
diff --git a/src/chapter18divideandconquer/Highest_PeakFinder_1D_Linear_Search.java b/src/chapter18divideandconquer/Highest_PeakFinder_1D_Linear_Search.java
index 90477e4..986f9a2 100644
--- a/src/chapter18divideandconquer/Highest_PeakFinder_1D_Linear_Search.java
+++ b/src/chapter18divideandconquer/Highest_PeakFinder_1D_Linear_Search.java
@@ -1,3 +1,5 @@
+package chapter18divideandconquer;
+
 public class Highest_PeakFinder_1D_Linear_Search{
 
   public static Integer findPeak(int[] A) {
diff --git a/src/chapter18divideandconquer/PeakFinder_1D_Binary_Search.java b/src/chapter18divideandconquer/PeakFinder_1D_Binary_Search.java
index c39d018..cfb1f7d 100644
--- a/src/chapter18divideandconquer/PeakFinder_1D_Binary_Search.java
+++ b/src/chapter18divideandconquer/PeakFinder_1D_Binary_Search.java
@@ -1,3 +1,4 @@
+package chapter18divideandconquer;
 public class PeakFinder_1D_Binary_Search{
 
   public static Integer findPeak(int[] A) {
diff --git a/src/chapter18divideandconquer/PeakFinder_1D_Linear_Search.java b/src/chapter18divideandconquer/PeakFinder_1D_Linear_Search.java
index af56834..b965f31 100644
--- a/src/chapter18divideandconquer/PeakFinder_1D_Linear_Search.java
+++ b/src/chapter18divideandconquer/PeakFinder_1D_Linear_Search.java
@@ -1,3 +1,5 @@
+package chapter18divideandconquer;
+
 public class PeakFinder_1D_Linear_Search{
 
   public static Integer findPeak(int[] A) {

From 29d4fa86a49386f4f39cb77d3c3af5e08459214a Mon Sep 17 00:00:00 2001
From: Kiran Hegde <kiran.hegde@staples.com>
Date: Thu, 9 Nov 2017 18:54:28 -0500
Subject: [PATCH 04/19] More minor fixes

---
 src/chapter21miscconcepts/RegexDemo.java | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/chapter21miscconcepts/RegexDemo.java b/src/chapter21miscconcepts/RegexDemo.java
index 8e6a85f..e55609d 100644
--- a/src/chapter21miscconcepts/RegexDemo.java
+++ b/src/chapter21miscconcepts/RegexDemo.java
@@ -1,3 +1,4 @@
+package chapter21miscconcepts;
 import java.util.regex.*;
 
 class RegexDemo{

From 3bae59256186ab85152b5add0879c402f446b91a Mon Sep 17 00:00:00 2001
From: shanmukht <shanmukht@users.noreply.github.com>
Date: Sun, 29 Apr 2018 18:53:43 -0700
Subject: [PATCH 05/19] currentSum was not calculated at each level.

---
 src/chapter06trees/FindLevelwithMaxSum.java | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/chapter06trees/FindLevelwithMaxSum.java b/src/chapter06trees/FindLevelwithMaxSum.java
index e942f75..3214a52 100644
--- a/src/chapter06trees/FindLevelwithMaxSum.java
+++ b/src/chapter06trees/FindLevelwithMaxSum.java
@@ -29,6 +29,7 @@ public int findLevelwithMaxSum(BinaryTreeNode root) {
 		while (!q.isEmpty()) {
 			BinaryTreeNode tmp = q.poll();
 			if (tmp != null) {
+				currentSum += tmp.getData();
 				if (tmp.getLeft() != null)
 					q.offer(tmp.getLeft());
 				if (tmp.right != null)

From 10c9ef5ad5000e026a257df6c7382ea628c5e1ef Mon Sep 17 00:00:00 2001
From: Mohit Goel <itsmohitgoel@gmail.com>
Date: Wed, 20 Feb 2019 22:44:28 +0530
Subject: [PATCH 06/19] fix: add condition for moving pointer to next nodes.

---
 src/chapter03linkedlists/DoublyLinkedList.java | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/chapter03linkedlists/DoublyLinkedList.java b/src/chapter03linkedlists/DoublyLinkedList.java
index 1140763..b0e0586 100644
--- a/src/chapter03linkedlists/DoublyLinkedList.java
+++ b/src/chapter03linkedlists/DoublyLinkedList.java
@@ -163,6 +163,7 @@ public synchronized void removeMatched(DLLNode node) {
 				p.next.prev = p.prev;
 				return;
 			}
+			p = p.getNext();
 		}
 	}
 	

From bd4ebef8b07c2c31d9c2c96fb7c104eb3fb6293d Mon Sep 17 00:00:00 2001
From: CareerMonk <careermonk@users.noreply.github.com>
Date: Tue, 2 Apr 2019 11:05:15 +0530
Subject: [PATCH 07/19] Create SortedSquaredArray2.java

---
 src/chapter10sorting/SortedSquaredArray2.java | 52 +++++++++++++++++++
 1 file changed, 52 insertions(+)
 create mode 100644 src/chapter10sorting/SortedSquaredArray2.java

diff --git a/src/chapter10sorting/SortedSquaredArray2.java b/src/chapter10sorting/SortedSquaredArray2.java
new file mode 100644
index 0000000..cc38413
--- /dev/null
+++ b/src/chapter10sorting/SortedSquaredArray2.java
@@ -0,0 +1,52 @@
+/*Copyright (c) Jul 2, 2015 CareerMonk Publications and others.
+ * E-Mail           	: info@careermonk.com 
+ * Creation Date    	: 2015-01-10 06:15:46 
+ * Last modification	: 2006-05-31 
+               by		: Narasimha Karumanchi 
+ * File Name			: ConvertArraytoSawToothWave.java
+ * Book Title			: Data Structures And Algorithms Made In Java
+ * Warranty         	: This software is provided "as is" without any 
+ * 							warranty; without even the implied warranty of 
+ * 							merchantability or fitness for a particular purpose. 
+ * 
+ */
+ 
+package chapter10sorting;
+ 
+class SortedSquaredArray {
+  public int[] sortedSquaredArray(int[] A) {
+      int n = A.length;
+      int j = 0;
+      // Find the last index of the negative numbers
+      while (j < n && A[j] < 0)
+          j++;
+      // i points to the last index of negative numbers
+      int i = j-1;
+
+      int[] result = new int[n];
+      int t = 0;
+      // j points to the first index of the positive numbers
+      while (i >= 0 && j < n) {
+          if (A[i] * A[i] < A[j] * A[j]) {
+              result[t++] = A[i] * A[i];
+              i--;
+          } else {
+              result[t++] = A[j] * A[j];
+              j++;
+          }
+      }
+      // add the remaining negative numbers squares to result
+      while (i >= 0) {
+          result[t++] = A[i] * A[i];
+          i--;
+      }
+
+      // add the remaining positive numbers squares to result
+      while (j < n) {
+          result[t++] = A[j] * A[j];
+          j++;
+      }
+
+      return result;
+  }
+}

From 0064c6abe64cd6625fb844bc30e20626e320a656 Mon Sep 17 00:00:00 2001
From: CareerMonk <careermonk@users.noreply.github.com>
Date: Tue, 2 Apr 2019 11:05:49 +0530
Subject: [PATCH 08/19] Create SortedSquaredArray.java

---
 src/chapter10sorting/SortedSquaredArray.java | 26 ++++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644 src/chapter10sorting/SortedSquaredArray.java

diff --git a/src/chapter10sorting/SortedSquaredArray.java b/src/chapter10sorting/SortedSquaredArray.java
new file mode 100644
index 0000000..daf3c32
--- /dev/null
+++ b/src/chapter10sorting/SortedSquaredArray.java
@@ -0,0 +1,26 @@
+/*Copyright (c) Jul 2, 2015 CareerMonk Publications and others.
+ * E-Mail           	: info@careermonk.com 
+ * Creation Date    	: 2015-01-10 06:15:46 
+ * Last modification	: 2006-05-31 
+               by		: Narasimha Karumanchi 
+ * File Name			: ConvertArraytoSawToothWave.java
+ * Book Title			: Data Structures And Algorithms Made In Java
+ * Warranty         	: This software is provided "as is" without any 
+ * 							warranty; without even the implied warranty of 
+ * 							merchantability or fitness for a particular purpose. 
+ * 
+ */
+ 
+ package chapter10sorting;
+ 
+class SortedSquaredArray {
+  public int[] sortedSquaredArray(int[] A) {
+      int n = A.length;
+      int[] result = new int[n];
+      for (int i = 0; i < n; ++i)
+          result[i] = A[i] * A[i];
+
+      Arrays.sort(result);
+      return result;
+  }
+}

From eb793313b372728a15f7cf3ec531913235e391ad Mon Sep 17 00:00:00 2001
From: narkarum <narkarum@in.ibm.com>
Date: Sun, 28 Jul 2019 23:23:35 +0530
Subject: [PATCH 09/19] Update GraphAdjacencyMatrix.java

---
 src/chapter09graphs/GraphAdjacencyMatrix.java | 125 ++++++++++++++++++
 1 file changed, 125 insertions(+)

diff --git a/src/chapter09graphs/GraphAdjacencyMatrix.java b/src/chapter09graphs/GraphAdjacencyMatrix.java
index 1f03480..6e70fc9 100644
--- a/src/chapter09graphs/GraphAdjacencyMatrix.java
+++ b/src/chapter09graphs/GraphAdjacencyMatrix.java
@@ -1 +1,126 @@
+/*Copyright (c) Dec 21, 2014 CareerMonk Publications and others.
+ * E-Mail           	: info@careermonk.com 
+ * Creation Date    	: 2015-01-10 06:15:46 
+ * Last modification	: 2006-05-31 
+               by		: Narasimha Karumanchi 
+ * File Name			: CLLNode.java
+ * Book Title			: Data Structures And Algorithms Made In Java
+ * Warranty         	: This software is provided "as is" without any 
+ * 							warranty; without even the implied warranty of 
+ * 							merchantability or fitness for a particular purpose. 
+ * 
+ */
+
 package chapter09graphs;
+import java.util.Iterator;
+import java.util.Random;
+import java.util.NoSuchElementException;
+
+public class Graph {
+    private static final String NEWLINE = System.getProperty("line.separator");
+
+    private final int V;
+    private int E;
+    private boolean[][] adjMatrix;
+
+    // empty graph with V vertices
+    public Graph(int V) {
+        if (V < 0) throw new IllegalArgumentException("Too few vertices");
+        this.V = V;
+        this.E = 0;
+        this.adjMatrix = new boolean[V][V];
+    }
+
+    // random graph with V vertices and E edges
+    public Graph(int V, int E) {
+        this(V);
+        if (E > (long) V*(V-1)/2 + V) throw new IllegalArgumentException("Too many edges");
+        if (E < 0)                    throw new IllegalArgumentException("Too few edges");
+        Random random = new Random();
+
+        // can be inefficient
+        while (this.E != E) {
+            int u = random.nextInt(V);
+            int v = random.nextInt(V);
+            addEdge(u, v);
+        }
+    }
+
+    // number of vertices and edges
+    public int V() { return V; }
+    public int E() { return E; }
+
+    // add undirected edge u-v
+    public void addEdge(int u, int v) {
+        if (!adjMatrix[u][v]) E++;
+        adjMatrix[u][v] = true;
+        adjMatrix[v][u] = true;
+    }
+
+    // does the graph contain the edge u-v?
+    public boolean contains(int u, int v) {
+        return adjMatrix[u][v];
+    }
+
+    // return list of neighbors of u
+    public Iterable<Integer> adjMatrix(int u) {
+        return new AdjIterator(u);
+    }
+
+    // support iteration over graph vertices
+    private class AdjIterator implements Iterator<Integer>, Iterable<Integer> {
+        private int u;
+        private int v = 0;
+
+        AdjIterator(int u) {
+            this.u = u;
+        }
+
+        public Iterator<Integer> iterator() {
+            return this;
+        }
+
+        public boolean hasNext() {
+            while (v < V) {
+                if (adjMatrix[u][v]) return true;
+                v++;
+            }
+            return false;
+        }
+
+        public Integer next() {
+            if (!hasNext()) {
+                throw new NoSuchElementException();
+            }
+            return v++;
+        }
+
+        public void remove()  {
+            throw new UnsupportedOperationException();
+        }
+    }
+
+    // string representation of Graph - takes quadratic time
+    public String toString() {
+        StringBuilder s = new StringBuilder();
+        s.append("Undirected graph" + NEWLINE);
+        s.append("Vertices:"+ V + " and edges:" + E + NEWLINE);
+        for (int u = 0; u < V; u++) {
+            s.append(u + ": ");
+            for (int v = 0; v < V; v++) {
+                s.append(String.format("%7s", adjMatrix[v][u]) + " ");
+            }
+            s.append(NEWLINE);
+        }
+        return s.toString();
+    }
+
+    // test code
+    public static void main(String[] args) {
+        int V = 5;
+        int E = 7;
+        Graph G = new Graph(V, E);
+        System.out.println(G.toString());
+    }
+
+}

From 2816666ebfcb124ed2987e5224f6d0689a31efcb Mon Sep 17 00:00:00 2001
From: narkarum <narkarum@in.ibm.com>
Date: Sun, 28 Jul 2019 23:59:37 +0530
Subject: [PATCH 10/19] Create GraphAdjacencyList.java

---
 src/chapter09graphs/GraphAdjacencyList.java | 177 ++++++++++++++++++++
 1 file changed, 177 insertions(+)
 create mode 100644 src/chapter09graphs/GraphAdjacencyList.java

diff --git a/src/chapter09graphs/GraphAdjacencyList.java b/src/chapter09graphs/GraphAdjacencyList.java
new file mode 100644
index 0000000..6340857
--- /dev/null
+++ b/src/chapter09graphs/GraphAdjacencyList.java
@@ -0,0 +1,177 @@
+/*Copyright (c) Dec 21, 2014 CareerMonk Publications and others.
+ * E-Mail           	: info@careermonk.com 
+ * Creation Date    	: 2015-01-10 06:15:46 
+ * Last modification	: 2006-05-31 
+               by		: Narasimha Karumanchi 
+ * File Name			: CLLNode.java
+ * Book Title			: Data Structures And Algorithms Made In Java
+ * Warranty         	: This software is provided "as is" without any 
+ * 							warranty; without even the implied warranty of 
+ * 							merchantability or fitness for a particular purpose. 
+ * 
+ */
+
+import java.io.*;
+import java.util.*;
+
+class LinkedList<Integer> implements Iterable<Integer> {
+    private ListNode<Integer> head;     // beginning of linked list
+    private int n;                      // number of elements in linked list
+
+    // helper linked list class
+    private static class ListNode<Integer> {
+        private Integer data;
+        private ListNode<Integer> next;
+    }
+
+    public LinkedList() {
+        head = null;
+        n = 0;
+    }
+
+    public boolean isEmpty() {
+        return head == null;
+    }
+
+    public int size() {
+        return n;
+    }
+
+    public void add(Integer data) {
+        ListNode<Integer> oldfirst = head;
+        head = new ListNode<Integer>();
+        head.data = data;
+        head.next = oldfirst;
+        n++;
+    }
+
+    public Iterator<Integer> iterator()  {
+        return new ListIterator(head);
+    }
+
+    // an iterator, doesn't implement remove() since it's optional
+    private class ListIterator implements Iterator<Integer> {
+        private ListNode<Integer> current;
+
+        public ListIterator(ListNode<Integer> head) {
+            current = head;
+        }
+
+        public boolean hasNext()  { return current != null;                     }
+        public void remove()      { throw new UnsupportedOperationException();  }
+
+        public Integer next() {
+            if (!hasNext()) throw new NoSuchElementException();
+            Integer data = current.data;
+            current = current.next;
+            return data;
+        }
+    }
+}
+public class Graph {
+    private static final String NEWLINE = System.getProperty("line.separator");
+
+    private final int V;
+    private int E;
+    private LinkedList<Integer>[] adjList;
+
+    // Initializes an empty graph with V vertices and 0 edges.
+    public Graph(int V) {
+        if (V < 0) throw new IllegalArgumentException("Number of vertices must be nonnegative");
+        this.V = V;
+        this.E = 0;
+        adjList = (LinkedList<Integer>[]) new LinkedList[V];
+        for (int u = 0; u < V; u++) {
+            adjList[u] = new LinkedList<Integer>();
+        }
+    }
+
+    // random graph with V vertices and E edges
+    public Graph(int V, int E) {
+        this(V);
+        if (E > (long) V*(V-1)/2 + V) throw new IllegalArgumentException("Too many edges");
+        if (E < 0)                    throw new IllegalArgumentException("Too few edges");
+        Random random = new Random();
+
+        // can be inefficient
+        while (this.E != E) {
+            int u = random.nextInt(V);
+            int v = random.nextInt(V);
+            addEdge(u, v);
+        }
+    }
+
+
+    // Initializes a new graph.
+    public Graph(Graph G) {
+        this(G.V());
+        this.E = G.E();
+        for (int u = 0; u < G.V(); u++) {
+            // reverse so that adjacency list is in same order as original
+            Stack<Integer> reverse = new Stack<Integer>();
+            for (int v : G.adjList[u]) {
+                reverse.push(v);
+            }
+            for (int v : reverse) {
+                adjList[u].add(v);
+            }
+        }
+    }
+
+    // Returns the number of vertices in this graph.
+    public int V() {
+        return V;
+    }
+
+    // Returns the number of edges in this graph.
+    public int E() {
+        return E;
+    }
+
+    // throw an IllegalArgumentException unless {@code 0 <= u < V}
+    private void validateVertex(int u) {
+        if (u < 0 || u >= V)
+            throw new IllegalArgumentException("vertex " + u + " is not between 0 and " + (V-1));
+    }
+
+    public void addEdge(int u, int v) {
+        validateVertex(u);
+        validateVertex(v);
+        E++;
+        adjList[u].add(v);
+        adjList[v].add(u);
+    }
+
+    // Returns the vertices adjacent to vertex {@code u}.
+    public Iterable<Integer> adjList(int u) {
+        validateVertex(u);
+        return adjList[u];
+    }
+
+    public int degree(int u) {
+        validateVertex(u);
+        return adjList[u].size();
+    }
+
+    // Returns a string representation of this graph.
+    public String toString() {
+        StringBuilder s = new StringBuilder();
+        s.append("Undirected graph" + NEWLINE);
+        s.append(V + " vertices, " + E + " edges " + NEWLINE);
+        for (int u = 0; u < V; u++) {
+            s.append(u + ": ");
+            for (int v : adjList[u]) {
+                s.append(v + " ");
+            }
+            s.append(NEWLINE);
+        }
+        return s.toString();
+    }
+
+    // test code
+    public static void main(String[] args) {
+        Graph G = new Graph(5, 7);
+        System.out.println(G.toString());
+    }
+
+}

From 3c32dea73cd7f069eb633f9ea9ceee087318c210 Mon Sep 17 00:00:00 2001
From: narkarum <narkarum@in.ibm.com>
Date: Mon, 29 Jul 2019 14:32:59 +0530
Subject: [PATCH 11/19] Create DFS.java

---
 src/chapter09graphs/DFS.java | 154 +++++++++++++++++++++++++++++++++++
 1 file changed, 154 insertions(+)
 create mode 100644 src/chapter09graphs/DFS.java

diff --git a/src/chapter09graphs/DFS.java b/src/chapter09graphs/DFS.java
new file mode 100644
index 0000000..2860bc8
--- /dev/null
+++ b/src/chapter09graphs/DFS.java
@@ -0,0 +1,154 @@
+/*Copyright (c) Dec 21, 2014 CareerMonk Publications and others.
+ * E-Mail           	: info@careermonk.com 
+ * Creation Date    	: 2015-01-10 06:15:46 
+ * Last modification	: 2006-05-31 
+               by		  : Narasimha Karumanchi 
+ * Book Title			    : Data Structures And Algorithms Made In Java
+ * Warranty         	: This software is provided "as is" without any 
+ * 							warranty; without even the implied warranty of 
+ * 							merchantability or fitness for a particular purpose. 
+ * 
+ */
+ import java.util.*;
+
+public class Graph {
+    private static final String NEWLINE = System.getProperty("line.separator");
+
+    private final int V;
+    private int E;
+    private boolean[][] adjMatrix;
+    boolean[] visited;
+
+    // empty graph with V vertices
+    public Graph(int V) {
+        if (V < 0) throw new IllegalArgumentException("Too few vertices");
+        this.V = V;
+        this.E = 0;
+        this.adjMatrix = new boolean[V][V];
+        visited = new boolean[V];
+    }
+
+    // random graph with V vertices and E edges
+    public Graph(int V, int E) {
+        this(V);
+        if (E > (long) V*(V-1)/2 + V) throw new IllegalArgumentException("Too many edges");
+        if (E < 0)                    throw new IllegalArgumentException("Too few edges");
+        Random random = new Random();
+
+        // can be inefficient
+        while (this.E != E) {
+            int u = random.nextInt(V);
+            int v = random.nextInt(V);
+            addEdge(u, v);
+        }
+        visited = new boolean[V];
+    }
+
+    // number of vertices and edges
+    public int V() { return V; }
+    public int E() { return E; }
+
+    // add undirected edge u-v
+    public void addEdge(int u, int v) {
+        if (!adjMatrix[u][v]) E++;
+        adjMatrix[u][v] = true;
+        adjMatrix[v][u] = true;
+    }
+
+    // does the graph contain the edge u-v?
+    public boolean contains(int u, int v) {
+        return adjMatrix[u][v];
+    }
+
+    // return list of neighbors of u
+    public Iterable<Integer> adjMatrix(int u) {
+        return new AdjIterator(u);
+    }
+
+    // support iteration over graph vertices
+    private class AdjIterator implements Iterator<Integer>, Iterable<Integer> {
+        private int u;
+        private int v = 0;
+
+        AdjIterator(int u) {
+            this.u = u;
+        }
+
+        public Iterator<Integer> iterator() {
+            return this;
+        }
+
+        public boolean hasNext() {
+            while (v < V) {
+                if (adjMatrix[u][v]) return true;
+                v++;
+            }
+            return false;
+        }
+
+        public Integer next() {
+            if (!hasNext()) {
+                throw new NoSuchElementException();
+            }
+            return v++;
+        }
+
+        public void remove()  {
+            throw new UnsupportedOperationException();
+        }
+    }
+
+    // string representation of Graph - takes quadratic time
+    public String toString() {
+        StringBuilder s = new StringBuilder();
+        s.append("Undirected graph" + NEWLINE);
+        s.append("Vertices:"+ V + " and edges:" + E + NEWLINE);
+        for (int u = 0; u < V; u++) {
+            s.append(u + ": ");
+            for (int v = 0; v < V; v++) {
+                s.append(String.format("%7s", adjMatrix[v][u]) + " ");
+            }
+            s.append(NEWLINE);
+        }
+        return s.toString();
+    }
+
+    void clearVisited(){
+        for (int i = 0; i < visited.length; i++)
+            visited[i] = false;
+    }
+
+    public void DFS(){
+        // Visit nodes using a Stack to store "to visit" nodes
+        Stack<Integer> s = new Stack<Integer>();  // Create a stack
+        clearVisited();       // Set all visited[i] = 0
+        s.push(0);            // Start the "to visit" at node 0
+
+        /* ===========================================
+        Loop as long as there are "active" node
+        =========================================== */
+        while( !s.isEmpty() ){
+            int nextNode;                // Next node to visit
+            int i;
+
+            nextNode = s.pop();
+
+            if ( ! visited[nextNode] ){
+                visited[nextNode] = true;    // Mark node as visited
+                System.out.println("nextNode = " + nextNode );
+
+                for ( i = 0; i < V; i++ )
+                //for ( i = V-1; i >= 0 ; i-- )
+                    if ( (this.adjMatrix[nextNode][i] == true) && !this.visited[i] )
+                        s.push(i);
+            }
+        }
+    }
+    public static void main(String[] args) {    //test code
+        int V = 5;
+        int E = 7;
+        Graph G = new Graph(V, E);
+        System.out.println(G.toString());
+        G.DFS();
+    }
+}

From 52ce2ae974627b6305e553c88f2e666e16a9ccf5 Mon Sep 17 00:00:00 2001
From: narkarum <narkarum@in.ibm.com>
Date: Mon, 29 Jul 2019 14:33:48 +0530
Subject: [PATCH 12/19] Create BFS.java

---
 src/chapter09graphs/BFS.java | 152 +++++++++++++++++++++++++++++++++++
 1 file changed, 152 insertions(+)
 create mode 100644 src/chapter09graphs/BFS.java

diff --git a/src/chapter09graphs/BFS.java b/src/chapter09graphs/BFS.java
new file mode 100644
index 0000000..4e2aa9d
--- /dev/null
+++ b/src/chapter09graphs/BFS.java
@@ -0,0 +1,152 @@
+/*Copyright (c) Dec 21, 2014 CareerMonk Publications and others.
+ * E-Mail           	: info@careermonk.com 
+ * Creation Date    	: 2015-01-10 06:15:46 
+ * Last modification	: 2006-05-31 
+               by		  : Narasimha Karumanchi 
+ * Book Title			    : Data Structures And Algorithms Made In Java
+ * Warranty         	: This software is provided "as is" without any 
+ * 							warranty; without even the implied warranty of 
+ * 							merchantability or fitness for a particular purpose. 
+ * 
+ */
+import java.util.*;
+
+public class Graph {
+    private static final String NEWLINE = System.getProperty("line.separator");
+
+    private final int V;
+    private int E;
+    private boolean[][] adjMatrix;
+    boolean[] visited;
+
+    // empty graph with V vertices
+    public Graph(int V) {
+        if (V < 0) throw new IllegalArgumentException("Too few vertices");
+        this.V = V;
+        this.E = 0;
+        this.adjMatrix = new boolean[V][V];
+        visited = new boolean[V];
+    }
+
+    // random graph with V vertices and E edges
+    public Graph(int V, int E) {
+        this(V);
+        if (E > (long) V*(V-1)/2 + V) throw new IllegalArgumentException("Too many edges");
+        if (E < 0)                    throw new IllegalArgumentException("Too few edges");
+        Random random = new Random();
+
+        // can be inefficient
+        while (this.E != E) {
+            int u = random.nextInt(V);
+            int v = random.nextInt(V);
+            addEdge(u, v);
+        }
+        visited = new boolean[V];
+    }
+
+    // number of vertices and edges
+    public int V() { return V; }
+    public int E() { return E; }
+
+    // add undirected edge u-v
+    public void addEdge(int u, int v) {
+        if (!adjMatrix[u][v]) E++;
+        adjMatrix[u][v] = true;
+        adjMatrix[v][u] = true;
+    }
+
+    // does the graph contain the edge u-v?
+    public boolean contains(int u, int v) {
+        return adjMatrix[u][v];
+    }
+
+    // return list of neighbors of u
+    public Iterable<Integer> adjMatrix(int u) {
+        return new AdjIterator(u);
+    }
+
+    // support iteration over graph vertices
+    private class AdjIterator implements Iterator<Integer>, Iterable<Integer> {
+        private int u;
+        private int v = 0;
+
+        AdjIterator(int u) {
+            this.u = u;
+        }
+
+        public Iterator<Integer> iterator() {
+            return this;
+        }
+
+        public boolean hasNext() {
+            while (v < V) {
+                if (adjMatrix[u][v]) return true;
+                v++;
+            }
+            return false;
+        }
+
+        public Integer next() {
+            if (!hasNext()) {
+                throw new NoSuchElementException();
+            }
+            return v++;
+        }
+
+        public void remove()  {
+            throw new UnsupportedOperationException();
+        }
+    }
+
+    // string representation of Graph - takes quadratic time
+    public String toString() {
+        StringBuilder s = new StringBuilder();
+        s.append("Undirected graph" + NEWLINE);
+        s.append("Vertices:"+ V + " and edges:" + E + NEWLINE);
+        for (int u = 0; u < V; u++) {
+            s.append(u + ": ");
+            for (int v = 0; v < V; v++) {
+                s.append(String.format("%7s", adjMatrix[v][u]) + " ");
+            }
+            s.append(NEWLINE);
+        }
+        return s.toString();
+    }
+
+    void clearVisited(){
+        for (int i = 0; i < visited.length; i++)
+            visited[i] = false;
+    }
+
+    public void BFS(){
+        // BFS uses Queue data structure
+        Queue<Integer> q = new LinkedList<Integer>();
+        clearVisited();
+        q.add(0);            // Start the "to visit" at node 0
+
+        /* ===========================================
+        Loop as long as there are "active" node
+        =========================================== */
+        while( !q.isEmpty() ) {
+            int nextNode;                // Next node to visit
+            int i;
+            nextNode = q.remove();
+            if ( ! visited[nextNode] ) {
+                visited[nextNode] = true;    // Mark node as visited
+                System.out.println("nextNode = " + nextNode );
+
+                for ( i = 0; i < V; i++ )
+                // for ( i = V-1; i >=0 ; i-- )
+                    if ( adjMatrix[nextNode][i] == true  && ! visited[i] )
+                    q.add(i);
+            }
+        }
+    }
+    public static void main(String[] args) {    //test code
+        int V = 5;
+        int E = 7;
+        Graph G = new Graph(V, E);
+        System.out.println(G.toString());
+        G.BFS();
+    }
+}

From af4db90c1b650a2f900941fc80f358a2f043bf05 Mon Sep 17 00:00:00 2001
From: CareerMonk <careermonk@users.noreply.github.com>
Date: Thu, 19 Sep 2019 11:09:47 +0530
Subject: [PATCH 13/19] Create CountingSort.java

---
 src/chapter10sorting/CountingSort.java | 59 ++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)
 create mode 100644 src/chapter10sorting/CountingSort.java

diff --git a/src/chapter10sorting/CountingSort.java b/src/chapter10sorting/CountingSort.java
new file mode 100644
index 0000000..b55c4b0
--- /dev/null
+++ b/src/chapter10sorting/CountingSort.java
@@ -0,0 +1,59 @@
+/*Copyright (c) Dec 21, 2014 CareerMonk Publications and others.
+ * E-Mail           	: info@careermonk.com 
+ * Creation Date    	: 2015-01-10 06:15:46 
+ * Last modification	: 2006-05-31 
+               by		: Narasimha Karumanchi 
+ * Book Title			: Data Structures And Algorithms Made In Java
+ * Warranty         	: This software is provided "as is" without any 
+ * 							warranty; without even the implied warranty of 
+ * 							merchantability or fitness for a particular purpose. 
+ * 
+ */
+ 
+ import java.util.*;
+import java.lang.*;
+import java.io.*;
+public class CountingSorter{
+    public static int[] CountingSort (int[] A, int K) {
+        int i, j, n = A.length; 
+        int[] C = new int[K+1];
+        int[] B = new int[n+1];
+        // Complexity: O(K) 
+        for (i =0 ; i <= K; i++) 
+            C[i] = 0; 
+            
+        // Complexity: O(n) 
+        for (j = 0 ; j < n; j++) 
+            C[A[j]] = C[A[j]] + 1;
+        // C[i] now contains the number of elements equal to i 
+
+        // Complexity: O(K) 
+        for (i =1 ; i <= K; i++) 
+            C[i] = C[i] + C[i-1];
+        // C[i] now contains the number of elements ≤ i 
+        
+        // Complexity: O(n) 
+        for (j = n-1; j>=0; j--) { 
+			B[C[A[j]]] = A[j]; 
+            C[A[j]] = C[A[j]] - 1; 
+        }
+        return B;
+    }
+    public static void main(String[] args) {
+
+      System.out.println("Counting sort in Java");
+      int[] A = { 6, 4, 3, 2, 1, 4, 3, 6, 6, 2, 4, 3, 4 };
+      int K = 6;
+      int[] B = new int[A.length + 1];
+
+      System.out.println("Input Array:");
+      System.out.println(Arrays.toString(A));
+
+      // sorting array using Counting Sort Algorithm
+      B = CountingSort(A, K);
+
+      System.out.println("Sorted array");
+      System.out.println(Arrays.toString(B));
+
+    }
+}

From 411d20da66d68f7070aa3ee5e44f283021945019 Mon Sep 17 00:00:00 2001
From: UmakanthSahu <69105946+UmakanthSahu@users.noreply.github.com>
Date: Thu, 1 Oct 2020 13:24:32 +0530
Subject: [PATCH 14/19] Update LogNComplexityDown.java

---
 src/chapter01introduction/LogNComplexityDown.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/chapter01introduction/LogNComplexityDown.java b/src/chapter01introduction/LogNComplexityDown.java
index ebe3398..7b67f30 100644
--- a/src/chapter01introduction/LogNComplexityDown.java
+++ b/src/chapter01introduction/LogNComplexityDown.java
@@ -23,7 +23,7 @@ public static void main(String[] args) {
 	
 	public static int logNUp(int n){
 		int count = 0;
-		for (int i = n; i>0;){
+		for (int i = n; i > 0; ){
 			count ++;
 			i = i / 2;
 		}

From 4d382c0f06407f3e1c94c3a3e0595d8b26a003cf Mon Sep 17 00:00:00 2001
From: UmakanthSahu <69105946+UmakanthSahu@users.noreply.github.com>
Date: Thu, 1 Oct 2020 13:25:52 +0530
Subject: [PATCH 15/19] Update LogNComplexityUp.java

---
 src/chapter01introduction/LogNComplexityUp.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/chapter01introduction/LogNComplexityUp.java b/src/chapter01introduction/LogNComplexityUp.java
index 352ce46..c68a2f8 100644
--- a/src/chapter01introduction/LogNComplexityUp.java
+++ b/src/chapter01introduction/LogNComplexityUp.java
@@ -24,7 +24,7 @@ public static void main(String[] args) {
 	
 	public static int logNUp(int n){
 		int count = 0;
-		for (int i = 1; i<n;){
+		for (int i = 1; i < n; ){
 			count ++;
 			i = i *2;
 		}

From 1408ac0b92130a531d56729bff48fc50bccfb2ed Mon Sep 17 00:00:00 2001
From: UmakanthSahu <69105946+UmakanthSahu@users.noreply.github.com>
Date: Thu, 1 Oct 2020 13:26:29 +0530
Subject: [PATCH 16/19] Update NComplexity.java

---
 src/chapter01introduction/NComplexity.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/chapter01introduction/NComplexity.java b/src/chapter01introduction/NComplexity.java
index b8b44df..e0d020e 100644
--- a/src/chapter01introduction/NComplexity.java
+++ b/src/chapter01introduction/NComplexity.java
@@ -23,7 +23,7 @@ public static void main(String[] args) {
 	}
 	public static int orderN(int n){
 		int count = 0;
-		for (int i = 1; i<n;){
+		for (int i = 1; i < n; ){
 			count ++;
 			i = i+1;
 		}

From ed36098b919fbc1a60be95cde37c0fa617fc94fc Mon Sep 17 00:00:00 2001
From: UmakanthSahu <69105946+UmakanthSahu@users.noreply.github.com>
Date: Thu, 1 Oct 2020 13:27:15 +0530
Subject: [PATCH 17/19] Update NPower3By2Complexity.java

---
 src/chapter01introduction/NPower3By2Complexity.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/chapter01introduction/NPower3By2Complexity.java b/src/chapter01introduction/NPower3By2Complexity.java
index 2b97acf..f2f017e 100644
--- a/src/chapter01introduction/NPower3By2Complexity.java
+++ b/src/chapter01introduction/NPower3By2Complexity.java
@@ -21,12 +21,12 @@ public static void main(String[] args) {
 		System.out.println(nPower3By2(n));
 	}
 	public static int nPower3By2(int n){
-		int i=1, j;
+		int i = 1, j;
 		int count = 0;
 		int sum = 0;
-		for (i = 0; i <n; i++){
+		for (i = 0; i < n; i++){
 			j = 0;
-			while(sum<i){
+			while(sum < i){
 				sum = sum + j;
 				j++;
 				count++;

From 4504ae09a445f9310a0d68aa3b0372a2618ccede Mon Sep 17 00:00:00 2001
From: UmakanthSahu <69105946+UmakanthSahu@users.noreply.github.com>
Date: Thu, 1 Oct 2020 13:28:58 +0530
Subject: [PATCH 18/19] Update NSquareLogNComplexity.java

---
 .../NSquareLogNComplexity.java                     | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/chapter01introduction/NSquareLogNComplexity.java b/src/chapter01introduction/NSquareLogNComplexity.java
index eb294b0..0341250 100644
--- a/src/chapter01introduction/NSquareLogNComplexity.java
+++ b/src/chapter01introduction/NSquareLogNComplexity.java
@@ -25,9 +25,9 @@ public static void main(String[] args) {
 	}
 	public static int nSquareLogN(int n){
 		int count = 0;
-		for (int i = 1; i<n;i = i *2){
-			for (int j = 1; j<n;j++){
-				for (int k = 1; k<n;k++){
+		for (int i = 1; i < n; i = i *2){
+			for (int j = 1; j < n; j++){
+				for (int k = 1; k < n; k++){
 					count ++;
 				}
 			}
@@ -36,7 +36,7 @@ public static int nSquareLogN(int n){
 	}
 	public static int nSquareLogN2(int n){
 		int count = 0;
-		for (int i = 1; i<n;i = i+1 ){
+		for (int i = 1; i < n; i = i + 1){
 			for (int j = 1; j<n;j = j*2){
 				for (int k = 1; k<n;k = k + 1){
 					count ++;
@@ -47,9 +47,9 @@ public static int nSquareLogN2(int n){
 	}
 	public static int nSquareLogN3(int n){
 		int count = 0;
-		for (int i = 1; i<n;i++){
-			for (int j = 1; j<n;j++){
-				for (int k = 1; k<n;k =  k *2){
+		for (int i = 1; i < n; i++){
+			for (int j = 1; j < n; j++){
+				for (int k = 1; k < n; k = k *2){
 					count ++;
 				}
 			}

From 126f387bdf97fe0c32847511fd61f431de137329 Mon Sep 17 00:00:00 2001
From: UmakanthSahu <69105946+UmakanthSahu@users.noreply.github.com>
Date: Thu, 1 Oct 2020 13:29:26 +0530
Subject: [PATCH 19/19] Update SquareRootNComplexity.java

---
 src/chapter01introduction/SquareRootNComplexity.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/chapter01introduction/SquareRootNComplexity.java b/src/chapter01introduction/SquareRootNComplexity.java
index 99f320b..202a1da 100644
--- a/src/chapter01introduction/SquareRootNComplexity.java
+++ b/src/chapter01introduction/SquareRootNComplexity.java
@@ -23,7 +23,7 @@ public static void main(String[] args) {
 	public static int squareRootN(int n){
 		int i=1;
 		int sum = 0;
-		while(sum<n){
+		while(sum < n){
 			sum = sum + i;
 			i++;
 		}
