You are on page 1of 31

A Project Report on

<Animated Data Structures>


Submitted in Partial Fulfillment of the Requirements for the Award of the Degree of Bachelor of Technology in
INFORMATION TECHNOLOGY
UNDER THE GUIDANCE OF Mr. Himanshu Sharma SUBMITTED BY Mohd Aqdus Ansari (0922913034) Sahil Mittal (0922913052) Shreya Gupta (0922913058) SUBMITTED TO DEPARTMENT OF INFORMATION TECHNOLOGY

VIDYA COLLEGE OF ENGINEERING, MEERUT GAUTAM BUDDHA TECHNICAL UNIVERSITY, LUCKNOW SESSION: 2011-12
1

TABLE OF CONTENTS
page

DECLARATION .................................................................................................... 3 ACKNOWLEDGEMENT ..................................................................................... 4 ABSTRACT ............................................................................................................ 5 LIST OF SYMBOLS .............................................................................................. 6 LIST OF ABBREVIATIONS ................................................................................ 7 INTRODUCTION................................................................................................... 8 PROBLEMS RELATED WITH CURRENT SYSTEM. 9 PROPOSED SYSTEM........................................................................................... 10 ADVANTAGES.................................................................................................... 11 MODULE DESCRIPTION .. 12-14 DESIGN................................................................................................. 15 E-R DIAGRAM REQUIREMENT SPECIFICATION................................................................... CODING............................................................................................................... FUTURE SCOPE................................................................................................. CONCLUSION.................................................................................................... REFERENCES..................................................................................................... 16 17-28 29 30 31

DECLARATION
I hereby declare that this submission is our own work and that, to the best of our knowledge and belief, it contains no material previously published or written by another person nor material which to a substantial extent has been accepted for the award of any other degree or diploma of the university or other institute of higher learning, except where due acknowledgment has been made in the text.

Signature Mohd Aqdus Ansari (0922913034)

Date:11/04/2012

Signature Sahil Mittal (0922913052)

Signature Shreya Gupta (0922913058)

ACKNOWLEDGEMENT
It gives us a great sense of pleasure to present the report of the Project Work, undertaken during B. Tech. Final Year. We owe special debt of gratitude to MR. HIMANSHU SHARMA, Department of Information technology,Vidya college of engineering, Meerut for his constant support and guidance throughout the course of our work. His sincerity, thoroughness and perseverance have been a constant source of inspiration for us. It is only his cognizant efforts that our endeavors have seen light of the day. We also take the opportunity to acknowledge the contribution of MR. RAMAN CHADDHA, Head, Department of Information Technology, Vidya College of Engineering, Meerut for his full support and assistance during the development of the project. We also do not like to miss the opportunity to acknowledge the contribution of all faculty members of the department for their kind assistance and cooperation during the development of our project. Last but not the least, we acknowledge our friends for their contribution in the completion of the project.

Signature: Name : Mohd Aqdus Ansari

Roll No.:0922913034 Date : 11/04/2012 Signature: Name :Shreya Gupta

Roll No.:0922913058 Date Signature: Name : Sahil Mittal :11/04/2012

Roll No.: 0922913052 Date : 11/04/2012 4

ABSTRACT
The project is an attempt to efficiently represent animated data structure & its operation, it also gives information regarding how we operate it. It is a versatile project and is also a secure project so that no unauthorized user can access it, as it can be used only by authorized user basically the administrator.

To give a birds eye view to this project, the member and there details have clearly demarcated and correlated as well.

The contents of project hold well and good acquaintance with all respects of management is it either concerning with the use of this application program. We have tried our best level to move ahead to attain the brim of excellence for efficient and versatile management, though some faults have crept up.

LIST OF SYMBOLS
<= <>= A[i] less than equal to Not Equal Assign Greater than equal to An array A at position i where i is any integer value

LIST OF ABBREVIATIONS
ADS DS BST BFS DFS Animated Data Structures Data Structures Binary Search Tree Breadth first search Depth first search

INTRODUCTION
The Animated Data Structure is an intelligent system developed as a teaching aid for a course on Data Structures to enhance students' understanding of data structures such as linked-lists, stacks, queues, trees and graphs. This project has the capability to display data structures graphically on the computer screen as well as allowing graphical manipulation of the data structure created. There is a mode for incorporating exercises, where students can learn basic algorithms to implement them practically on high level language. The traditional role of teachers and learners connotes with manually which is much more far away from reaching on the innovative concepts. The knowledge obtained is then applied to practical exercises in a supervised laboratory session, generally of two hours duration. Students have to complete their project within the session, and may consult qualified tutors concerning the task. In computer science education, the visualization and interactive animation of abstract data structures has a positive effect on learning algorithms and is regarded as attractive by students. Multimedia , this is a new concept which used in every respective field then how this field untouched from this concept. High level multimedia courseware packages have become widely available, providing coaching in a wide range of topics, from phonics and drawing to mathematics and chemistry. But here we implement the multimedia on new enhancement with good knowledge of software.

PROBLEMS RELATED WITH CURRENT SYSTEM

Nowadays in every institution the subjects are taught traditionally by the use of board and chalks or with the help of markers. This mode of teaching makes the subject really bore and students do not take keen interest. Data structure is a very vital subject for CS/IT students leaving which they suffer in future. The teacher use to give notes which students seldom study. So, a new mode should be there which can make this subject really interesting an students gather interest in studying this crucial subject which is only possible if the see all the algorithms working in front of them.

PROPOSED SYSTEM

In our Animated Data Structure a student can understand their core subject easily through animation. In this, we provide visualization and interactive abstract data structures and overcome the problems of students to solve basic things. We give some functionality in our project: Overview of using animation Provide assessment to students Class notes

10

ADVANTAGES

It allows the teachers to save time by not to write on boards. It allows freedom to students from writing several notes. It reduces paper work. Easily understandable by students. Interactive way of studying data structure as it gives an animated form of solving
algorithms.

11

MODULE DESCRIPTION
HOME PAGE: Firstly, we give the overview of using the animated data structure. In this,
we enhance our environment with basic information that in actual what is data structure and where, why we use this? In student mind, lots of queries arise that for what purpose we read data structure. So, we provide the homepage to understand the basic things like wikipedia.

INTRODUCTION MODE: In this basically, it introduce how we flexibly we use the


data structure in animated mode which enhance with user friendly environment. In the introduction mode, we provide what data structure actually we use to run in animation. What the algorithms are used to implement these data structure and basically what are these. Before presenting anything we need some practical implication that from other side we get the response, same exactly here we provide introduction mode.

12

RUN ANIMATION: Here finally, we get the final output which are very innovative,
influence to others easily and assert to work on them. In this page, the insertion, deletion, pop, push, replace, help etc. or other various options are provided to run them.

13

14

DESIGN

15

REQUIREMENT SPECIFICATION
SOFTWARE SPECIFICATION:
We used the following web browser : Internet Explorer, Mozilla Firefox, Google Chrome.

Front end:- Java Script, HTML

HARDWARE SPECIFICATION:
At least 256 MB RAM. Intel P4 or above processor Intel 945 mother board or above.

16

CODING
HOME PAGE
<html> <head> <title>home page</title></head> <body> <b> <h1><center><font size="12" style="serief" color="red" ><u>DATA STRUCTURE</u></font></center></H1></b> <pre> </pre> <left>Data structure is a representation of the logical relationship existing between individual elements of data.In other words,a data structure is a way of organizing all data items that considers not only the elements stored but also their relationship to each other.</left> <pre> </pre> <left> Data structure mainly specifies the following four things: <ol> <li>Organization of data <li>Accessing methods <li>Degree of associativity <li>Processing alternatives for information </ol> </left><pre> </pre>

17

<p><left>Data structures are the building block of a program and hence the selection of a particular data structure stresses on the following two things: <ol> <li>The data structure must be rich enough in structure to reflect the relationship existing between the data. <li>The structure should be simple so that we can process data effectively whenever required. </ol></left></p> <left>List of data structures provided to students: <DL> <DL> <DL> <DL> <DL> <DL> <DL> <LI><A href="sorting.html"><font color="purple" >Sortings </font></A> <LI><A href="stack.html"><font color="purple" >Stack </font></A> <LI><A href="queue.html"><font color="purple" >Queue </font></A> <LI><A href="tree.html"><font color="purple" >Tree</font></A> <LI><A href="graph.html"><font color="purple" >Graph</font></A> </DL></DL></DL></DL></DL></DL></DL></BODY></HTML>

INTODUCTION PAGE
<html> <head> <title>sortings</title></head>

18

<body > <b> <h1><center><font size="12" style="serief" color="red" ><u>Sortings</u></font></center></H1></b> <pre> </pre> <p><left>Sorting is a basic operation in computer science.Sorting refers to the operation of arranging data in some given sequence i.e. increasing order or decreasing order.

Sorting is categorised as internal sorting or external sorting. By internal sorting means we are arranging the numbers within the array only which is in computer primary memory, where the external sorting is the sorting of numbers from the external file by reading it from secondary memory.</left></p> <pre> </pre> <p><left>Let P be the list of m elements P1,P2,P3...Pm in memory.Sorting P means arranging the contents of P in either increasing or decreasing order i.e.., </left></p> <pre> P1<=P2<=P3.....<=Pm </pre> <p><left> There are m elements in the list therefore there are m! ways to arrange them. </left></p>

<left>List of sortings provided: <DL> <DL>

19

<DL> <DL> <DL> <DL> <DL> <LI><A href="insertion.html"><font color="purple" >Insertion Sort </font></A> <LI><A href="selection.html"><font color="purple" >Selection Sort </font></A> <LI><A href="quick.html"><font color="purple" >Quick Sort</font></A> <LI><A href="merge.html"><font color="purple" >Merge Sort</font></A>

</DL></DL></DL></DL></DL></DL></DL></BODY></HTML>

</body> </html>

RUN ANIMATION
import java.awt.Canvas; import java.awt.Color; import java.awt.Component; import java.awt.Dimension; import java.awt.Font; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Image;

class Animate extends Canvas implements Runnable { Thread animation; messageCanvas mcanvas;

20

itemCanvas icanvas; condition myCondition; Graphics osG; Image osImg; boolean startOut = true; Dimension osD; int xb; int yb; int xt; int yt; int size; int block_size; Box[] button; boolean fnext; boolean fdisplaycolorterminology; boolean fdrawTable; boolean fdrawB; final int sleep_time = 5;

public Animate(messageCanvas parammessageCanvas, itemCanvas paramitemCanvas, condition paramcondition) { setSize(750, 250); setVisible(true); setBackground(Color.pink);

this.icanvas = paramitemCanvas; this.mcanvas = parammessageCanvas; this.myCondition = paramcondition; this.animation = new Thread(this); }

public void paint(Graphics paramGraphics)

21

{ update(paramGraphics); }

public void update(Graphics paramGraphics) { if (this.startOut) { this.startOut = false; this.osD = getSize(); this.osImg = createImage(this.osD.width, this.osD.height); this.osG = this.osImg.getGraphics(); }

if ((this.osD.width != getSize().width) || (this.osD.height != getSize().height)) { this.osD = getSize(); this.osImg = createImage(this.osD.width, this.osD.height); this.osG = this.osImg.getGraphics(); }

this.osG.setColor(Color.pink); this.osG.fillRect(0, 0, this.osD.width, this.osD.height);

if (this.fdrawTable) { drawTable(this.osG, this.xt, this.yt, 10, this.block_size); }

if (this.fdrawB) { for (int i = 0; i < 10; ++i)

22

{ drawB(this.osG, this.button[i].xcoordinate, this.button[i].ycoordinate, this.button[i].value, this.button[i].color); } }

if (this.fdisplaycolorterminology) { displayColorTerminology(this.osG); }

paramGraphics.drawImage(this.osImg, 0, 0, this); }

public void displayColorTerminology(Graphics paramGraphics) { Font localFont1 = new Font("Serief", 1, 20); Font localFont2 = new Font("Serief", 1, 15); paramGraphics.setFont(localFont1);

FontMetrics localFontMetrics = paramGraphics.getFontMetrics();

Dimension localDimension = getSize(); paramGraphics.setColor(Color.black);

paramGraphics.drawRect(5, localDimension.height / 2 - 100, localDimension.width - 10, 250); paramGraphics.fillRect(5, localDimension.height / 2 - 100, localDimension.width - 10, 250);

paramGraphics.setColor(Color.green); String str = "Colour Terminology"; int i = localFontMetrics.stringWidth(str);

23

paramGraphics.drawString(str, (localDimension.width - i) / 2, localDimension.height / 2 - 100 + localFontMetrics.getHeight() + 10); paramGraphics.drawLine((localDimension.width - i) / 2, localDimension.height / 2 - 100 + localFontMetrics.getHeight() + 20, (localDimension.width - i) / 2 + i, localDimension.height / 2 - 100 + localFontMetrics.getHeight() + 20);

int j = (localDimension.width - i) / 2; paramGraphics.setColor(Color.red); paramGraphics.setFont(localFont2); paramGraphics.fillRect(j, 125, 20, 20); paramGraphics.drawString("--> unsorted subsequence", j + 25, 140); paramGraphics.setColor(Color.blue); paramGraphics.fillRect(j, 175, 20, 20); paramGraphics.drawString("--> sorted subsequence", j + 25, 190); paramGraphics.setColor(Color.cyan); paramGraphics.fillRect(j, 225, 20, 20); paramGraphics.setColor(Color.cyan); paramGraphics.drawString("--> under consideration", j + 25, 240); paramGraphics.setColor(Color.yellow); paramGraphics.drawString("Press Continue Button To Continue", j, 290); }

public void drawTable(Graphics paramGraphics, int paramInt1, int paramInt2, int paramInt3, int paramInt4) { for (int i = 0; i < paramInt3; ++i) { paramGraphics.setColor(Color.black); paramGraphics.drawRect(paramInt1, paramInt2, paramInt4, paramInt4); paramInt1 += paramInt4; } }

24

public void drawB(Graphics paramGraphics, int paramInt1, int paramInt2, int paramInt3, int paramInt4) { String str = new String(""); int k = 40; Font localFont = new Font("Serief", 1, 25); paramGraphics.setFont(localFont); FontMetrics localFontMetrics = paramGraphics.getFontMetrics(); str = str + paramInt3;

switch (paramInt4) { case 0: paramGraphics.setColor(Color.red); break; case 2: paramGraphics.setColor(Color.blue); break; case 1: paramGraphics.setColor(Color.cyan); }

paramGraphics.fill3DRect(paramInt1 + 5, paramInt2 + 5, k, k, true); paramGraphics.setColor(Color.white); int i = paramInt1 + 5 + (k - localFontMetrics.stringWidth(str)) / 2; int j = paramInt2 + 5 + localFontMetrics.getAscent() + (k localFontMetrics.getAscent()) / 2; paramGraphics.drawString(str, i, j); }

public void run() {

25

Dimension localDimension = getSize();

this.block_size = 50; this.size = 40;

this.button = new Box[10]; this.xt = ((localDimension.width - 10 * this.block_size) / 2); this.yt = 100;

this.xb = (this.xt + 5); this.yb = (this.yt + 5);

this.fnext = true; this.fdisplaycolorterminology = false; this.fdrawTable = false; this.fdrawB = false;

this.fdisplaycolorterminology = true; String str = new String("Look At The Color Pattern : Press CONTINUE Button To Move Ahead"); this.mcanvas.setMessage(str); updateCanvas(false);

insertionSort.cont.setEnabled(true); this.myCondition.WAIT();

this.fdisplaycolorterminology = false; repaint();

int i = this.xt; for (int j = 0; j < 10; ++j) { this.button[j] = new Box();

26

this.button[j].value = (int)(100.0D * Math.random());

this.button[j].xcoordinate = i; this.button[j].ycoordinate = this.yt; this.button[j].color = 0; i += this.block_size; }

str = "Generating Random Numbers"; this.mcanvas.setMessage(str); this.fdrawTable = true; this.fdrawB = true; updateCanvas(true);

sort(); this.mcanvas.setMessage("SORTING COMPLETED"); this.icanvas.setValue(-20); updateCanvas(true); insertionSort.next.setEnabled(false);

this.mcanvas.setMessage("If You Want To RERUN The Algorithm Please Press The 'RESET' Button "); this.mcanvas.repaint(); insertionSort.reset.setEnabled(true); }

public void sort() { int i = 0; Graphics localGraphics = getGraphics();

for (int j = 1; j < this.button.length; ++j) {

27

this.icanvas.setValue(this.button[j].value);

String str = "Selecting Item # this.mcanvas.setMessage(str);

" + (j + 1);

this.button[j].color = 1;

updateCanvas(true);

for (i = j - 1; i >= 0; --i) { str = "Comparing " + this.button[(i + 1)].value + " ( Item " + (i + 2) + " ) With Item # " + (i + 1); this.mcanvas.setMessage(str); this.button[i].color = 1; updateCanvas(true);

if (this.button[(i + 1)].value < this.button[i].value) { str = this.button[(i + 1)].value + " Is LESS Than " + this.button[i].value + " Hence SWAPPING .."; this.mcanvas.setMessage(str); this.mcanvas.repaint();

if (i == j - 1) { moveUpAndLeft(localGraphics, i + 1, i); } else { moveLeft(localGraphics, i + 1, i); }

28

moveRight(localGraphics, i);

...

FUTURE SCOPE
As we know that animated data structure is a sort of e-book which guide the students properly about data structures. The future scope of this project is that we can conduct an exam option in the end which can be solved by the students to judge their knowledge about ds. This project can be put on any institution network by which the students can view this on institutions LAN by which they need not refer books from library or any other place.

29

CONCLUSION
From a proper analysis of positive points and constraints on the component, it can be safely concluded that the product is a highly efficient GUI based component. This application is working properly and meeting to all user requirements. This component can be easily plugged in many other systems. A User can easily understand all the features of this ADSs.

30

REFERNCES
Book referencing: 1. William B. Frakes, Ricardo Baeza-Yates. Information retrieval : data structures & algorithms, Englewood Cliffs, N.J. : Prentice Hall. 2. Herbert schildt,The complete reference Java 7th edition

31