0% found this document useful (0 votes)
24 views11 pages

Ds Report

Data structure project report
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views11 pages

Ds Report

Data structure project report
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

Government polytechnic , karad .

SECOND YEAR DIPLOMA ENGINEERING

( I-SCHEME)

MICROPROJECT OF DATA STRUCTURE

“ on topic

Tree transversal data structure”

Zanzane shveta shailesh (1266)


Dagade shreya gorakh (1208)
Misal kajal aba (1237)
ACKNOWLEDGMENT

We take this opportunity to thank all those who have directly and indirectly inspired,
directed and assisted us towards successful completion of this project report.

We express our sincere thanks to a Principle, Dr. R. K. Patil and the head of department Mrs.
sujata patil , Lecturer of Computer Engineering Department Mrs. Archana paike , for having allowed
us to submit this report as a part of our academic learning.

We express the sincere thanks to Mrs. Archana paike, Computer Engineering Department ,
Govt. Polytechnic Karad for her encouraging throughout this project report and guideline in
designing and working out this project.

We are also grateful to team " DSU" for their highly encouraging and co-operative
attitude. We express our sense of gratitude towards our friends and parents for their constant moral
support during.

Yours sincerely,

Zanzane shveta shailesh (1266)

Dagade shreya gorkh(1208)

Misal kajal aba (1237)


CERTIFICATE
This is to certify that, as part of the partial fulfilment of the Three diploma course for the
semester second, the bonafide students studying in First year diploma (Computer ) , I scheme.

Zanzane shveta shailesh(1266), dagade shreya gorakh (1208),misal kajal aba (1237) have
completed the project report titled as , " TREE TRANSVERSAL DATA STRUCTURE – DSU, under the
guidance of Mrs. Archana paike and submitted it to Department of
Computer Engineering , Govt. Polytechnic Karad. The information presented in this project report has
not been submitted earlier .

Mrs. sujata patil Mrs. Archana paike

(head of department) (Guide)

Date:

Place: Govt.polytechnic ,karad


Micro project report

Title:Tree transversal data structure

1.0 Brief introduction

A tree is a hierarchical data structure made up of nodes and connected by the edges.
HTML and XML are two markup languages that use a tree structure, in which the root
includes child branches, which may have their own child branches, and so on. Tree
traversal in a data structure is a type of graph traversal in computer science. It is the
process by which each node in a tree data structure is visited exactly once.

2.0 Aim of the micro-project

1) to get knowledge of c programming .

2) to get knowledge of tree transversal data structure .

3) to develop c program to perform operation.

3.0 Actual procedure followed .

1) decide subject for micro project.


2) preparation and submission of abstract.
3) collection of data
4) discussion and outline of content .
5) formulation of content .
6) editing of content.
7) compilation of report presentation .
8) final submission of micro project.

4.0 Actual resources used

Sr.no Name of specifications Qty remarks


resources
/materials
1 Computer Basic 1
system configuration
2 Software Turbo c 1
3 Internet Google ,etc
4 Books Tech max

5.0 output of the micro projects

What is tree traversal in data structure ?

Tree traversal in a data structure is a type of graph traversal in the data structure that
refers to the process of visiting, verifying, and updating each node in a tree data
structure just once. The order in which you examine the nodes of the tree is used to
classify these traversals.

 Stack data structure

This first data structure is a stack, which is a container for added and
removed items according to the last-in-first-out (LIFO) principle.
 Queue data structure

The second data structure is the queue data structure. The first-in, first-out
(FIFO) concept governs how you add and withdraw objects in linear data sets from a
queue. You will cover the varieties of tree traversal in the data structure next in this
data structure tutorial .

Types of the traversal in data structure

You can perform tree traversal in the data structure in numerous ways,
unlike arrays, linked lists, and other linear data structures, which are canonically
traversed in linear order. You can walk through them in either a depth-first search or a
breadth-first search. In-order, pre-order, and post-order are the three most frequent
ways to go over them in depth-first.

Beyond these fundamental traversals, more complex or hybrid techniques,


such as depth-limited searches, such as iterative deepening depth-first search, are
feasible.

in-order traversal (root-left-right)

1) Traverse root subtree


2) Traverse left node
3) traverse right subtree

uses of in order traversal


In order traversal gives nodes in non-decreasing order in binary search trees or
BST. A version of In order traversal with In order traversal reverse can access BST
nodes in non-increasing order.

Pre-order traversal (root-left-right)


1) traverse root node
2) traverse left subtree
3) traverse right subtree

uses of pre-order traversal

You can delete the tree using post-


order traversal. The postfix expression of tree data structure can also be obtained
using post-order traversal.

Post order traversal (left-right-root)


1) traverse left subtree
2) traverse right subtree
3) traverse root node
Uses of post order traversal
You can delete the tree using post-order traversal. The postfix
expression of tree data structure can also be obtained using post-order traversal.

Implementations of the tree traversal in data structure

code implementing all three tree traversal in data structure

#include <stdio.h>
#include <stdlib.h>
enum traversal {preorder_travesal, inorder_travesal, postorder_traversal};
typedef enum traversal trav;
typedef struct node node;
struct node {
int x;
node* left_node, *right_node;
};
node* create_tree (int data) {
// creating tree
node->left_node=root->right_node= NULL;
root->x=data;
return root;
}
node->left_node = node-> right_node=NULL;
return node;
}
void release_tree (node*root){
//releasing tree
node* t=root;
if (!t)
return ;
release_tree (t->left_node);
release_tree (t->right_node);
if (!t-> left_node & &! t->right_node) {
free(t);
return ;
}
}
void displaytree (traversal trav, node*root){
if(! root)
return ;
switch (trav){
case (preorder_traversal): //pre-order travesal
printf("%d - >", root->x);
displaytree(trav, root->left_node);
displaytree (trav, root->right_node);
break;
case (inorder_traversal)://inorder traversal
displaytree (trav, root->left_node);
printf("%d->", root->x);
displaytree (trav, root->right_node);
break;
}
}
int main(){
node*root=create_tree(5);
root->left_node=create_node(10);
root->right_node=create_node(15);
root->left_node->left_node=create_node(20);
root->left_node->right_node=create_node(25);
root->right_node->left_node=create_node(30);
root->right_node->right_node=create_node(35);
printf("preorder transversing");
displaytree (preorder_travesal, root);
printf("postorder traversing \n");
displaytree (postorder_traversal, root);
release tree(root);
return 0;
}
Output of tree traversal code:
Preorder traversing
5->10->20->25->15->30->35->
Inorder traversing
20->10->25->5->30->15->35->
Postorder traversing
20->25->10->30->35->15->5->

You might also like