[Java] Visual Stack 11-07-2013, 10:35 AM
#1
Stack
Stack is a data structure that follows the LIFO (Last-In-First-Out) principle. Newly added elements are added to the top and the most recent inseretd data are to be removed first as well.
Visual Stack
This applet is very simple and shows the working of a stack.
Video Demonstration
Screenshot
Description
We have a text area and you need to write certain commands for this to work.
We need to know about the stack ADT first. A stack does the following operations :-
1. Push ; Pushes an element to the top.
2. Pop: Removes the top element
3. peek: Returns the top element.
4. size: returns the size of the stack.
We have 5 keywords here, namely - push, pop, top, size, and delay.
push and delay work as the following syntax :- <instruction> <single-space> <data>
push :- Push the data into the stack. Example : push you, push 2, push IAmDull etc
delays : delay the update of the stack and its visualization.
pop, top, size are single instructions.
pop : pops the top element.
top : Shows the top element in logs.
size : Shows the size of the stack in logs.
Code
https://github.com/PsychoCoderHC/VisualStack
PS: This has been kept very simple but can be extended for better capabilities. I might update it later. This applet has been specially made for HCDevs New Project started by @Deque.
You may except a detailed tutorial on Stacks very soon.
Thank you,
Sincerely,
Psycho_Coder
Stack is a data structure that follows the LIFO (Last-In-First-Out) principle. Newly added elements are added to the top and the most recent inseretd data are to be removed first as well.
Visual Stack
This applet is very simple and shows the working of a stack.
Video Demonstration
Spoiler: Open
Screenshot
Spoiler: Open
Description
We have a text area and you need to write certain commands for this to work.
We need to know about the stack ADT first. A stack does the following operations :-
1. Push ; Pushes an element to the top.
2. Pop: Removes the top element
3. peek: Returns the top element.
4. size: returns the size of the stack.
We have 5 keywords here, namely - push, pop, top, size, and delay.
push and delay work as the following syntax :- <instruction> <single-space> <data>
push :- Push the data into the stack. Example : push you, push 2, push IAmDull etc
delays : delay the update of the stack and its visualization.
pop, top, size are single instructions.
pop : pops the top element.
top : Shows the top element in logs.
size : Shows the size of the stack in logs.
Code
https://github.com/PsychoCoderHC/VisualStack
PS: This has been kept very simple but can be extended for better capabilities. I might update it later. This applet has been specially made for HCDevs New Project started by @Deque.
You may except a detailed tutorial on Stacks very soon.
Thank you,
Sincerely,
Psycho_Coder
![[Image: OilyCostlyEwe.gif]](http://fat.gfycat.com/OilyCostlyEwe.gif)