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
12 changes: 12 additions & 0 deletions DataStructures/Queues/Queues.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
*
*/
class Queue {
/**
* Default initial capacity.
*/
private static final int DEFAULT_CAPACITY = 10;

/**
* Max size of the queue
*/
Expand All @@ -30,6 +35,13 @@ class Queue {
*/
private int nItems;

/**
* init with DEFAULT_CAPACITY
*/
public Queue() {
this(DEFAULT_CAPACITY);
}

/**
* Constructor
*
Expand Down
12 changes: 12 additions & 0 deletions DataStructures/Stacks/StackArray.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ public static void main(String[] args) {
System.out.println(myStackArray.peek()); // will print 2
}

/**
* Default initial capacity.
*/
private static final int DEFAULT_CAPACITY = 10;

/**
* The max size of the Stack
*/
Expand All @@ -49,6 +54,13 @@ public static void main(String[] args) {
*/
private int top;

/**
* init Stack with DEFAULT_CAPACITY
*/
public StackArray() {
this(DEFAULT_CAPACITY);
}

/**
* Constructor
*
Expand Down