Simulation of Recursion and Data Structures
Simulation of Recursion and Data Structures
Submitted by
NIRMAL SURESH
SAID SINAN KOTTANGODAN
NIYAS P I
in partial fulfilment for the award of the degree
of
B. TECH DEGREE
in
COMPUTER SCIENCE & ENGINEERING
SCHOOL OF ENGINEERING
COCHIN UNIVERSITY OF SCIENCE & TECHNOLOGY
KOCHI-682022
Division of Computer Engineering,SOE
Page 1
CERTIFICATE
Certified that this is a bonafide record of the project work titled
NIRMAL SURESH
SAID SINAN KOTTANGODAN
NIYAS.P.I
of VI semester Computer Science & Engineering in the year 2014 in
partial fulfilment of the requirements for the award of Degree of
Bachelor of Technology in Computer Science & Engineering of
Cochin University of Science & Technology.
DR.SUDHEEP ELAYIDOM M
Project Guide
Division of Computer Engineering,SOE
PRAMOD PAVITHRAN
Head of division
Page 2
First of all we thank The Almighty God for blessing us and supporting us
throughout this endeavour.
We take this opportunity to express our profound and sincere gratitude to our
guide Mr. DR.SUDHEEP ELAYIDOM M for her exemplary guidance, monitoring
and constant encouragement throughout the course of this project.
We also take this opportunity to express a deep sense of gratitude to our class
co-ordinator Mrs. Preetha S for their cordial support, valuable suggestion and
guidance.
We gratefully acknowledge the support extended by Head Of the Division, Mr.
Pramod Pavithran and also thank him for letting us use the lab facilities.
We are also obliged to the staff members of the division for their cooperation
during the period of the project.
Lastly, we thank all our friends without whom this project would not be possible.
NIRMAL SURESH
SAID SINAN KOTTANGODAN
NIYAS.P.I
Page 3
To make the student easier to study how the operations on data sturucture and various
algorithms are performed.the data structures can be stack,queue and linked list etc and
algorithms are sorting like bubble sort,insertion sort etc.
Programming language
1.HTML
2.JAVA
Page 4
Figure No.
Page No.
1.
Bubble Sort
2.
Insertion Sort
10
3.
Quick Sort
12
4.
Selection Sort
14
5.
16
6.
20
7.
Linked List
22
Page 5
CHAPTER NO.
TITLE
PAG NO
ABSTRACT
LIST OF FIGURES
1.
INTRODUCTION
2.
REQUIREMENTS ENGINEERING
14
14
SYSTEM REQUIREMENT
3.1 ALGORITHMS
15
15
17
19
21
Page 6
4.
23
27
23
27
29
SYSTEM ENVIRONMENT
4.1 MINIMUM HARDWARE CONFIGURATION 32
4.2 MINIMUM SOFTWARE CONFIGURATION 32
4.3 SOFTWARE FEATURES
5.
6.
4.3.1 HTML
32
4.3.2 JAVA
33
DESIGN
35
35
36
39
SYSTEM TESTING
40
40
40
41
Page 7
CONCLUSION
REFFERNCES
42
43
Page 8
array, stack, queue, and linked list as well. Thus our web page provides effective
and efficient knowledge of data structures. This also provide some theoretical
knowledge regarding the data structure.
1.2 Objectives
.To study how the operations on data structure and algorithms are performed.
And how the values are compared in a sorting algorithms and swapped. Total
Number of comparison and exchanges performed in a sorting algorithm.
And the corresponding code performed while sorting.
.To get a clear idea about various data structures and operations on it.
And how can we implement a data structure.
Page 9
Page 10
The principal benefit of a linked list over a conventional array is that the list
elements can easily be inserted or removed without reallocation or reorganization
of the entire structure because the data items need not be stored contiguously in
memory or on disk. Linked lists allow insertion and removal of nodes at any point
in the list, and can do so with a constant number of operations if the link previous
to the link being added or removed is maintained during list traversal.
On the other hand, simple linked lists by themselves do not allow random access
to the data, or any form of efficient indexing. Thus, many basic operations
such as obtaining the last node of the list (assuming that the last node is not
maintained as separate node reference in the list structure), or finding a node
that contains a given datum, or locating the place where a new node should be
inserted may require scanning most or all of the list elements.
1.4 Algorithms
1.4.1 Bubble Sort:
Bubble sort, sometimes incorrectly referred to as sinking sort, is a simple sorting
algorithm that works by repeatedly stepping through the list to be sorted,
comparing each pair of adjacent items and swapping them if they are in the
wrong order. The pass through the list is repeated until no swaps are needed,
Division of Computer Engineering,SOE
Page 11
The algorithm divides the input list into two parts: the sublist of items already
sorted, which is built up from left to right at the front (left) of the list, and the
sublist of items remaining to be sorted that occupy the rest of the list. Initially, the
sorted sublist is empty and the unsorted sublist is the entire input list. The
algorithm proceeds by finding the smallest (or largest, depending on sorting
order) element in the unsorted sublist, exchanging it with the leftmost unsorted
element (putting it in sorted order), and moving the sublist boundaries one
element to the right.
1.4.3 Insertion sort:
Insertion sort is a simple sorting algorithm that builds the final sorted array (or
list) one item at a time. It is much less efficient on large lists than more advanced
algorithms such as quicksort, heapsort, or merge sort. However, insertion sort
provides several advantages:
Simple implementation
Division of Computer Engineering,SOE
Page 12
Page 13
or
documentation
of
the
requirements,
for
instance.
expense how to solve the problem and to determine the problem is solved. The
system has been tested for feasibility in the following ways.
Technical feasibility
Operational feasibility
Economical feasibility
Division of Computer Engineering,SOE
Page 14
Figure 1: Bubble sort-This contain the text field for input values.The fields in
comparisons and Exchanges gives the number of comparison and exchanges.it
highlight the current code which is executing.
Code
public int[] bubbleSort(int[] data){
int lenD = data.length;
int tmp = 0;
Division of Computer Engineering,SOE
Page 15
Page 16
Figure 2: Insertion sort-This contain the text field for input values.The fields in
comparisons and Exchanges gives the number of comparison and exchanges.it
highlight the current code which is executing.n gives no.of values,x,k and i are
the pointers.
Code
void SortAlgo::insertionSort(int data[], int lenD)
{
int key = 0;
int i = 0;
for(int j = 1;j<lenD;j++){
key = data[j];
Division of Computer Engineering,SOE
Page 17
Page 18
Figure 3: Quick sort-This contain the text field for input values.The fields in
comparisons and Exchanges gives the number of comparison and exchanges.it
highlight the current code which is executing.,i and j are the pointers.stack area
shows the contents in the stack
Code
public int[] quickSort(int[] data){
int lenD = data.length,pivot=0,i,j=0,k=0;int lenD/2
if(lenD<2){
return data;}
else{ int[] L = new int[lenD];
int[] R = new int[lenD];
int[] sorted = new int[lenD];
Division of Computer Engineering,SOE
Page 19
R[k] = data[i];
k++;
Page 20
Figure 4:Selection Sort-This contain the text field for input values.The fields in
comparisons and Exchanges gives the number of comparison and exchanges.it
highlight the current code which is executing.n gives no.of values.,k and i are the
pointers.
Code
public int[] selectionSort(int[] data){
int lenD = data.length;
int j = 0;
int tmp = 0;
Division of Computer Engineering,SOE
Page 21
3.2.Data Structures
Division of Computer Engineering,SOE
Page 22
Page 23
Page 24
Page 25
return root;}
Page 26
Code
public void preOrder(Node Root)
{ if(Root != null)
{ System.out.print(Root.item + " ");
preOrder(Root.leftChild);
preOrder(Root.rightChild);
}}
public void inOrder(Node Root)
{if(Root != null)
{ inOrder(Root.leftChild);
Division of Computer Engineering,SOE
Page 27
Page 28
Figure 7:Linked List-Contain 4 buttons. Ins front, Ins Rear Del front and Search
for insert from front,insert from Rear delete from Front and Search a specified
value respectively
Code
public class LinkList {
Page 29
Page 30
Page 31
4.SYSTEM ENVIRONMENT
4.1 Minimum Hardware Configuration
1. Pentium IV Processor
2. 512 MB RAM
3. 40GB HDD
4. 1024 * 768 Resolution Color Monitor
Note: This is not the System Requirements.
4.2 Minimum Software Configuration
1. Operating System: Windows XP
2.HTML,JAVA
Page 32
4.3.2 JAVA
Java is a computer programming language that is concurrent, classbased, object-oriented, and specifically designed to have as few implementation
dependencies as possible. It is intended to let application developers "write once,
run anywhere" (WORA), meaning that code that runs on one platform does not
need to be recompiled to run on another. Java applications are typically compiled
to bytecode (class file) that can run on any Java virtual machine (JVM)
regardless of computer architecture. Java is, as of 2014, one of the most popular
Division of Computer Engineering,SOE
Page 33
The original and reference implementation Java compilers, virtual machines, and
class libraries were developed by Sun from 1991 and first released in 1995. As of
May 2007, in compliance with the specifications of the Java Community Process,
Sun relicensed most of its Java technologies under the GNU General Public
License. Others have also developed alternative implementations of these Sun
technologies, such as the GNU Compiler for Java (bytecode compiler), GNU
Classpath (standard libraries), and IcedTea-Web (browser plugin for applets).
Page 34
Page 35
Page 36
User interface design requires a good understanding of user needs. There are
several phases and processes in the user interface design, some of which are
more demanded upon than others, depending on the project. (Note: for the
remainder of this section, the word system is used to denote any project whether
it is a website, application, or device.)
Functionality requirements gathering assembling a list of the functionality
required by the system to accomplish the goals of the project and the potential
needs of the users.
User analysis analysis of the potential users of the system either through
discussion with people who work with the users and/or the potential users
themselves. Typical questions involve:
What would the user want the system to do?
How would the system fit in with the user's normal workflow or daily activities?
How technically savvy is the user and what similar systems does the user
already use?
What interface look & feel styles appeal to the user?
Information architecture development of the process and/or information flow of
the system (i.e. for phone tree systems, this would be an option tree flowchart
and for web sites this would be a site flow that shows the hierarchy of the pages).
Page 37
Page 38
Page 39
6.SYSTEM TESTING
System
testing
is
the
stage
of
implementation, which is aimed at ensuring that the system works accurately and
efficiently before live operation commences. Testing is the process of executing
the program with the intent of finding errors and missing operations and also a
complete verification to determine whether the objectives are met and the user
requirements are satisfied. The ultimate aim is quality assurance. Tests are
carried out and the results are compared with the expected document. In the
case of erroneous results, debugging is done. Using detailed testing strategies a
test plan is carried out on each module. The various tests performed in Network
Backup System are unit testing, integration testing and user acceptance
testing.
6.1 Unit Testing
The software units in a system are modules and
routines that are assembled and integrated to perform a specific function. Unit
testing focuses first on modules, independently of one another, to locate errors.
This enables, to detect errors in coding and logic that are contained within each
module. This testing includes entering data and ascertaining if the value matches
to the type and size supported. The various controls are tested to ensure that
each performs its action as required.
6.2 Integration Testing
Data can be lost across any interface, one
module can have an adverse effect on another, sub functions when combined,
may not produce the desired major functions. Integration testing is a systematic
testing to discover errors associated within the interface. The objective is to take
unit tested modules and build a program structure. All the modules are combined
and tested as a whole. Here the Server module and Client module options are
integrated and tested. This testing provides the assurance that the application is
well integrated functional unit with smooth transition of data.
Page 40
Page 41
Page 42
. http://www.cosc.canterbury.ac.nz/
.http://www.w3schools.com/
.http://www.hawai.education.com/
.Michael Waite and Robert Lafore, Data Structures and Algorithms in Java
,Techmedia, NewDelhi, 1998.
Page 43
Page 44