diff --git a/QueueLink.java b/QueueLink.java index 9d8f774..eaf4594 100644 --- a/QueueLink.java +++ b/QueueLink.java @@ -18,7 +18,7 @@ public QNode(int key) { //last node of LL class Queue { - QNode front, rear; + QNode front = null, rear = null; public Queue() { this.front = this.rear = null; @@ -78,4 +78,4 @@ public static void main(String[] args) System.out.println("Dequeued item is "+ q.dequeue().key); } -} \ No newline at end of file +} diff --git a/README.md b/README.md index 6192cf8..c96963a 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ # Data-Structures -This repository contains implementation of data structures in java. +This repository contains implementation of data structures programs in java. diff --git a/StackDemo.java b/StackDemo.java index c9d9ca7..c160372 100644 --- a/StackDemo.java +++ b/StackDemo.java @@ -1,5 +1,5 @@ public class StackDemo { - private static final int capacity = 3; + private static final int capacity = 7; int arr[] = new int[capacity]; int top = -1; diff --git a/StackLinkedlist.java b/StackLinkedlist.java index 2d7fe69..41eceb8 100644 --- a/StackLinkedlist.java +++ b/StackLinkedlist.java @@ -47,7 +47,7 @@ public int getData() /* Class linkedStack */ class linkedStack { - protected Node top ; + protected Node top = null ; protected int size ; /* Constructor */ @@ -182,4 +182,4 @@ public static void main(String[] args) } while (ch == 'Y'|| ch == 'y'); } -} \ No newline at end of file +}