0% found this document useful (0 votes)
429 views23 pages

Micro-Project Proposal: Brief Introduction

The micro-project aims to develop a C program that creates a binary tree using linked lists to store a given data set. It will then locate and display specific data from the data set. The program will implement a binary search tree to store the data, with each node containing data, left, and right pointers. The tree will allow searching for data in logarithmic time on average. The group will discuss the topic, collect information, divide tasks, and develop the C program to meet the course outcome of implementing a program to create and traverse a tree to solve problems.

Uploaded by

sujal thaware
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
429 views23 pages

Micro-Project Proposal: Brief Introduction

The micro-project aims to develop a C program that creates a binary tree using linked lists to store a given data set. It will then locate and display specific data from the data set. The program will implement a binary search tree to store the data, with each node containing data, left, and right pointers. The tree will allow searching for data in logarithmic time on average. The group will discuss the topic, collect information, divide tasks, and develop the C program to meet the course outcome of implementing a program to create and traverse a tree to solve problems.

Uploaded by

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

Micro-Project Proposal

Develop a C program that creates a tree to store given data


set using Linked List. Locate and display Specific data from
data set

BRIEF INTRODUCTION: -
• A tree is a non-linear data structure used to represent the hierarchical
structure of one or more Elements, which are known as nodes of the tree.
• Each node of a tree stores a data value and has zero or more pointers
pointing to the other nodes of the tree which are known as its child nodes.
• Each node in a tree can have zero or more child nodes, which is at one level
below it. However, each child node can have only one parent node, which
is at one level above it.
• The node at the top of the tree is known as the root of the tree and the nodes
at the lowest level are known as the leaf nodes

In this project, we need to create the binary tree by inserting nodes and
displaying nodes in inorder fashion. A typical binary tree can be represented
as follows:

In the binary tree, each node can have at most two children. Each node can have
zero, one or two children. Each node in the binary tree contains the following
information:

• Data that represents value stored in the node


• Left that represents the pointer to the left child.
• Right that represents the pointer to the right child.

Government Polytechnic, Arvi Page 1


AIM OF THE MICRO-PROJECT: -
• Develop a “C” program that creates a tree to store given data set
using Linked List. Locate and display Specific data from data
Set.

COURSE OUTCOMES: -
CO e. Implement program to create and traverse tree to solve problems.

LITERATURE REVIEW: -
A binary search tree, also known as ordered binary search tree, is a variation of
rooted binary tree in which the nodes are arranged in an order. [1]:298 The nodes
of the tree store a key (and optionally, an associated value), and each has two
distinguished sub-trees, commonly denoted left and right. The tree additionally
satisfies the binary search property: the key in each node is greater than or equal
to any key stored in the left sub-tree, and less than or equal to any key stored in
the right sub-tree.[2]: 287 Thus, BST requires an order relation by which every
node of the tree is comparable with every other node in the sense of total order.
Binary search trees are also efficacious in sorting algorithms and search
algorithms. However, the U search complexity of a BST depends o upon the order
in which the nodes are inserted and deleted; since in worst case, successive
operations in the binary search tree may lead to degeneracy and form a singly
linked list (or “unbalanced tree”) like structure, thus has the same worst-case
complexity as a linked list.[3][1]: 299-302 Binary search trees are also a
fundamental data structure used in construction of abstract data structures such
as sets, multisets, and associative arrays.

Binary search tree :-


It is a type of Binary tree .
Properties :-
1) All nodes of the left subtrees are lesser.

Government Polytechnic, Arvi Page 2


2) All nodes of the right subtrees are greater.
3) Left and right subtrees are also Binary search tree(BST)
4) There are no duplicate nodes.

Ex. 1)
8
/\
5 9 ---→ this is not a BST
/\ /\
3 241

Ex. 2)
10
/\
5 20 -----→ this is a BST
/\ /\
3 8 15 30

Important Point
When in – order Traversal is done in BST
We get Elements printed in sorted format.

Like if,
In – order Traversal is done in Ex. 2
We get Elements printed as –
3,5,8,10,15,20,30
(only works in BST).

Government Polytechnic, Arvi Page 3


Important Point
Searching in BST is very fast,as we remove half the Elements
From search scope.
Best time / Average time complexity : O(log n)
Worst time complexity : O(n)

PROPOSED METHODOLOGY: -
• Understand the topic given to us.
• Discuss about the topic with group members.
• Divide the topic throughout each member of the group.
• Collected the information from member and verify from our lecturer.
• Prepared the main report of our micro project.

RESOURCES REQUIRED: -
Sr. Name of Specification Quantity Remarks
No Resources
1. Computer Computer (i3-i5 1
System preferable), RAM
minimum 2GB
2. Operating Windows 10 1
system
3. Turbo C For compiling C 1
program

Action Plan: -

Sr. No Details of Activity Planned Planned Team


start date finish date Members
1 To discuss and get thetopic of All
micro project. 27-10-2021 01-11-2021

Government Polytechnic, Arvi Page 4


2 Start planning on topic ofmicro All
project. 01-11-2021 03-11-2021

3 Collect information aboutour All


topic. 03-11-2021 09-11-2021

4 Distribute works withingroup All


members. 09-11-2021 12-11-2021
To start with creating with main
5 copy of microproject. 12-11-2021 17-11-2021 All

Collect different information


6 about microproject. 17-11-2021 22-11-2021 All

7 Initiate different views about All


micro project. 22-11-2021 24-11-2021

8 Editing process must bedone All


before hard copy. 24-11-2021 29-11-2021
Check softcopy properlybefore
9 preparing of hardcopy. 29-11-2021 03-12-2021 All
10 To start creating copy All
properly. 03-08-2021 08-12-2021

11 Checking the informationfrom All


monitor. 08-12-2021 10-12-2021
12 Check the soft copy. All
10-12-2021 15-12-2021
13 To present soft copy via All
G-mail. 15-12-2021 18-12-2021
Represented the hardcopy of All
14 main micro project. 20-12-2021

Government Polytechnic, Arvi Page 5


GROUP MEMBERS: -

Sr. No. Student Name Signature


1 Tejas Pokale
2 Yash Gangamwar
3 Puja jamankar
4 Vaibhavi Nasare
5 Tanmay Zalke
6. Sujal Thaware

Government Polytechnic, Arvi Page 6


MICRO-PROJECT REPORT ON

“DEVELOP A “C” PROGRAM THAT CREATES A TREE TO


STORE GIVEN DATA SET USING LINKED LIST. LOCATE AND
DISPLAY SPECIFIC DATA FROM DATA SET ”
IN PARTIAL FULFILMENT OF DIPLOMA IN COMPUTER ENGINEERING

(Third Semester)

In the Subject of
Data Structures Using C (22317)

Submitted By
Tejas Pokale
Yash Gangamwar
Puja jamankar
Vaibhavi Nasare
Tanmay Zalke
Sujal Thaware
Submitted To

Maharashtra State Board of Technical Education, Mumbai (M.S)

Under the Guidance of

Prof. H. Ranotkar

Lecturer In

Department of Computer Engineering

Government Polytechnic, Arvi Page 7


Government Polytechnic Arvi Dist.-Wardha

(2021-2022)

Government Polytechnic, Arvi.


Department of Computer Engineering

Certificate
This is to certify, that students whose name mention below of Third
Semester of Diploma in Computer Engineering has satisfactorily
completed the Micro project entitled “Develop a “C” program that
creates a tree to store given data set using Linked List. Locate and
display Specific data from data Set” in Data Structures Using C or the
academic year 2021-22 as Prescribed in MSBTE curriculum.

Name Enrollment No Seat No.

Tejas Pokale 2001320158 174379


Yash Gangamwar 2001320166 174380
Puja jamankar 2001320169 174381
Vaibhavi Nasare 2001320175 174384
Tanmay Zalke 2001320177 174385
Sujal Thaware 2101320098 289492

Subject Teacher Head of the Department Principal

Place: Arvi
Date:

Government Polytechnic, Arvi Page 8


Declaration

We under signed hereby declare that the micro project report entitled “Develop
a C program that creates a tree to store given data set using Linked List.
Locate and display Specific data from data set”. I further declare that contents
of this report are properly citied and well acknowledge. This present report is not
submitted to any other examination of this or any other institute for the award of
any diploma.

Place: Arvi
Date:

(Signature)

----------------------------
----------------------------
----------------------------
----------------------------
----------------------------

Government Polytechnic, Arvi Page 9


Micro-Project Proposal

Develop a “C” program that creates a tree to store given


data set using Linked List. Locate and display Specific data
from data set

RATIONALE: -
The representation we use singly linked list. In this representation each node
requires three fields,

• One for the link of the left Child,


• Second field for representing the Information associated with the node,
and
• The Third is used to represent the link of the
• right child.

When A node has no child then the corresponding pointer fields are null. The left
and right field of a node is pointer to left and the right child of that node.

INTENDED COURSE OUTCOMES: -

CO e. Implement program to create and traverse tree to solve problems.

LITERATURE REVIEW: -
A binary search tree, also known as ordered binary search tree, is a
variation of rooted binary tree in which the nodes are arranged in an
order. [1]:298 The nodes of the tree store a key (and optionally, an
associated value), and each has two distinguished sub-trees, commonly
denoted left and right. The tree additionally satisfies the binary search
property: the key in each node is greater than or equal to any key stored

Government Polytechnic, Arvi Page 10


in the left sub-tree, and less than or equal to any key stored in the right
sub-tree.[2]: 287 Thus, BST requires an order relation by which every
node of the tree is comparable with every other node in the sense of
total order. Binary search trees are also efficacious in sorting
algorithms and search algorithms. However, the U search complexity
of a BST depends o upon the order in which the nodes are inserted and
deleted; since in worst case, successive operations in the binary search
tree may lead to degeneracy and form a singly linked list (or
“unbalanced tree”) like structure, thus has the same worst-case
complexity as a linked list.[3][1]: 299-302 Binary search trees are also
a fundamental data structure used in construction of abstract data
structures such as sets, multisets, and associative arrays.
Binary search tree :-
It is a type of Binary tree .
Properties :-
1) All nodes of the left subtrees are lesser.
2) All nodes of the right subtrees are greater.
3) Left and right subtrees are also Binary search tree(BST)
4) There are no duplicate nodes.

Ex. 1)
8
/\
5 9 ---→ this is not a BST
/\ /\
3 241

Ex. 2)
10

Government Polytechnic, Arvi Page 11


/\
5 20 -----→ this is a BST
/\ /\
3 8 15 30

Important Point
When in – order Traversal is done in BST
We get Elements printed in sorted format.

Like if,
In – order Traversal is done in Ex. 2
We get Elements printed as –
3,5,8,10,15,20,30
(only works in BST).

Important Point
Searching in BST is very fast,as we remove half the Elements
From search scope.
Best time / Average time complexity : O(log n)
Worst time complexity : O(n)

ACTUAL METHODOLOGY FOLLOWED: -

All the group members had performed and done their work Correctly.

Works performed by group members individually are:

1] Tejas Pokale has worked on flowchart, Algorithm and program of the


microproject.

Government Polytechnic, Arvi Page 12


2] Yash Gangamwar provided information for the microproject and worked on
introduction, literature review and Rationale.

3] Puja Jamankar also provided information and has worked on action plan and
application of these Microproject.

4] Vaibhavi Nasare has Provided information about the skills developed in these
Microproject and learning outcome of these Microproject.

5] Tanmay Zalke and Sujal Thaware has provided information about the area of
future development of these Microproject.

ACTUAL RESOURCES REQUIRED: -

Sr. Name of Specification Quantity Remarks


No Resources
1. Computer Computer (i3-i5 1
System preferable), RAM
minimum 2GB
2. Operating Windows 10 1
system
3. Turbo C+ For compiling C 1
program

Algorithm: -

Government Polytechnic, Arvi Page 13


1. Define Node class which has three attributes namely: data left and
right. Here, left represents the left child of the node and right
represents the right child of the node.
2. When a node is created, data will pass to data attribute of the node
and both left and right will be set to null.
3. Define another class which has an attribute root.
a. Root represents the root node of the tree and initialize
it to null.

4.insert() will add a new node to the tree:

a. It checks whether the root is null, which means the tree


is empty. It will add the new node as root.

b. Else, it will add root to the queue.

c. The variable node represents the current node

d.First, it checks whether a node has a left and right child.

If yes, it will add both nodes to queue.

e. If the left child is not present, it will add the new node as
the left child.
f. If the left is present, then it will add the new node as the
right child.

5.Inorder() will display nodes of the tree in inorder fashion.

a. It traverses the entire tree then prints out left child

followed by root then followed by the right child.

Government Polytechnic, Arvi Page 14


C PROGRAM:-

//BINARY SEARCH TREE (BST)

#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
Typedef struct Node {
Int data ;
Struct Node *left ;
Struct Node *right ;
} Tree ;

//NODE CREATOR
Tree * create(int data){
Tree *ptr = (Tree*) malloc(sizeof(Tree)) ;
Ptr -> data = data ;
Ptr -> left = NULL ;
Ptr -> right = NULL ;

Return ptr ;
}
//Function to insert data in BST
Void insert(Tree **root , int val){
If((*root) == NULL)

Government Polytechnic, Arvi Page 15


(*root) = create(val) ;
Else{
If( (*root) -> data > val)
Insert(&((*root) -> left) , val) ;
Else if((*root) -> data < val)
Insert(&((*root) -> right) , val) ;
Else printf(“Similar Data not allowed in Binary Tree 
\n”) ;
}

}
Tree * minValueNode (Tree * root){
Tree * current = root ;
While(current -> left != NULL)
Current = current -> left ;
Return current ;
}
//Function to remove data from bst
Tree * remove (Tree *root , int val){
If(root == NULL)
Return root ;
Else{
If( root -> data > val)
Root -> left = remove(root -> left , val) ;
Else if(root -> data < val)
Root -> right = remove(root-> right , val) ;
Else {
If(root -> left == NULL){
Tree *temp = root -> right ;
Free(root) ;

Government Polytechnic, Arvi Page 16


Return temp ;
}
Else if(root -> right == NULL){
Tree *temp = root -> left ;
Free(root) ;
Return temp ;
}
Else{
Tree * temp = minValueNode (root -> right) ;
Root -> data = temp -> data ;
Root-> right = remove(root -> right , temp ->
data) ;
}
}
}
Return root ;
}
//In – order Traversal
Void inOrder(Tree *root){
If(root == NULL)
Return;
inOrder(root -> left);
printf(“Element : %d \n”,root -> data);
inOrder(root -> right);
}
//Pre – order Traversal
Void PreOrder(Tree *root){
If(root == NULL)
Return;
Printf(“Element : %d \n”,root -> data);

Government Polytechnic, Arvi Page 17


PreOrder(root -> left);
PreOrder(root -> right);
}
//Post – order Traversal
Void PostOrder(Tree *root){
If(root == NULL)
Return;
PostOrder(root -> left);
PostOrder(root -> right);
Printf(“Element : %d \n”,root -> data);
}
//Function to check is given BT is BST or not
Int isBST(Tree *root){
Static Tree *prev = NULL ;
If(root != NULL){
If(!isBST(root -> left)){
Return 0;
}
If(prev != NULL && prev -> data > root -> data){
Return 0;
}
Prev = root ;
Return isBST(root -> right);
}
Else{
Return 1;
}
}
//Function to search (iteratively) Element in the BST
Tree * searchIterative(Tree *root,int val){

Government Polytechnic, Arvi Page 18


While(root != NULL){
If(val == root -> data)
Return root;
Else if(val > root -> data)
Root = root -> right ;
Else
Root = root -> left ;
}
Return NULL ;
//if Element is present it returns it’s Address
//else it return NULL (0)
//after printing it u will see non – zero number
//if Element is present
//else u will see 0.
}
//Function to search (recursively) Element in the BST
Tree *searchRecursive(Tree * root,int val){
If(root == NULL)
Return NULL;
Else if(root -> data == val)
Return root ;
Else if(root -> data < val)
Return searchRecursive(root -> right, val);
Else
Return searchRecursive(root -> left,val);
}
Int main()
{
Tree * root , *temp ;
Int choise , data ;

Government Polytechnic, Arvi Page 19


Do{
Printf(“Enter 0 :- to exit\n”) ;
Printf(“Enter 1 :- to insert data\n”) ;
Printf(“Enter 2 :- to remove data\n”) ;
Printf(“Enter 3 :- to search from data\n”) ;
Printf(“Enter 4 :- to display data\n”) ;
Printf(“Enter 5 :- to clear Console\n”);
Printf(“\nPlease enter your choice : “) ;
Scanf(“%d”,&choise) ;
Switch(choise){
Case 0 :
Printf(“\nGood bye ☺ \n”) ;
Break ;
Case 1 :
Printf (“\nEnter data : “) ;
Scanf (“%d”,&data) ;
Insert(&root , data) ;
Printf(“Data has been inserted successfully ☺\n\n”)
;
Break ;
Case 2 :
Printf (“\nEnter data : “) ;
Scanf (“%d”,&data) ;
Root = remove(root , data) ;
Printf(“Data has been deleted successfully ☺\n\n”)
;
Break ;
Case 3 :
Printf(“Enter Data to be Searched : “) ;
Scanf (“%d”,&data) ;
Temp = searchRecursive (root , data) ;

Government Polytechnic, Arvi Page 20


If(temp == NULL)
Printf(“Data didn’t exist in Tree \n\n”) ;
Else printf(“%d exist in the Tree ☺\n\n”,data) ;
Break ;
Case 4 :
inOrder(root) ;
printf(“\n”) ;
break ;
case 5 :
clrscr() ;
break ;
default :
printf(“Pls enter right choice -_-\n”) ;
break ;
}
}while(choise != 0) ;
Return 0;
}

Government Polytechnic, Arvi Page 21


Output of program:-

SKILL DEVELOPED/LEARNING OUT OF THE MICRO-


PROJECT: -
• Ability to perform a team work
• Communicate effectively in order and written
• Ability to Building the circuit
• Communication with team member as a leader or member.

Government Polytechnic, Arvi Page 22


FUTURE IMPROVEMENT: -
There’s a problem in binary Trees or Binary Search Trees that they might grow
in only one direction , so to avoid these problems we can use following
improvements :-
• Develop (various functions) and use of AVL trees .
AVL trees are self balancing binary Trees which are stickly based on
balance factor
• Develop and proper use of Red – Black tree
Red – Black tree are the better version of both binary tree and AVL trees.

References
➢ https://www.javatpoint.come
➢ https://www-geeksforgeeks-org.s
➢ https://en.m.wikipedia.e

Conclusion
Thus , we have created tree (Binary Search Tree) using linked List i.e. (each
Node will be dynamically created) in a menu driven program and taken user
input to store and display the data accordingly.
We also performed most effective work for which trees are used (searching)
using both iterative and recursive method .

Government Polytechnic, Arvi Page 23

You might also like