Tuesday, June 16, 2015

Visual Stack Application in Java

I made an application to graphically demonstrate the working of Stack. So, I made this application called Visual Stack which allows the users to interact and understand the working of Stack. In this post I have posted about VisualStack. Read ahead to get to know more about it.

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 inserted 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

[Image: visualstack_zps5e183d58.png]

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.

Project on Github :- https://github.com/rawCoders/VisualStack


Related articles

0 comments :

Post a Comment

Follow Me!

Blog Archive

Followers

Visitor Map