Skip to content

Instantly share code, notes, and snippets.

@deepaksinghvi
Created May 1, 2019 14:45
Show Gist options
  • Save deepaksinghvi/aa54f8a7ae3c477cbe41db0089330418 to your computer and use it in GitHub Desktop.
Save deepaksinghvi/aa54f8a7ae3c477cbe41db0089330418 to your computer and use it in GitHub Desktop.
Stack Implementation using Deque
/**
* 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