Created
May 1, 2019 14:45
-
-
Save deepaksinghvi/aa54f8a7ae3c477cbe41db0089330418 to your computer and use it in GitHub Desktop.
Stack Implementation using Deque
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Author: Deepak Singhvi | |
*/ | |
public class StackDeque extends DequeueImpl { | |
public static void main(String args[]) { | |
StackDeque stack = new StackDeque(); | |
stack.push(1); | |
stack.push(2); | |
stack.push(3); | |
stack.push(4); | |
System.out.println(stack.pop()); | |
System.out.println(stack.toString()); | |
} | |
public void push(Integer element) { | |
insertAtFirst(element); | |
} | |
public Integer pop() { | |
return removeFirst(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment