You are on page 1of 9

DECCAN EDUCATION SOCIETYS

FERGUSSON COLLEGE ,PUNE.

A PROJECT REPORT
ON
BINARY TREE
SUBMITTED TO

UNIVERSITY OF PUNE.
IN THE PARTIAL FULFILLMENT OF THE DEGREE
OF
M.C.A(SCIENCE) III
SEMESTER V.
BY
Deccan Education Societys
Fergusson College, Pune
Department Of Computer Science

CERTIFICATE
This is to certify that the project entitled
Binary Tree
Submitted by
in partial fulfillment of the requirement of the completion of M.C.A.-III[Semester-V],
to University of Pune, has been carried out by them under our guidance
satisfactorily during the Academic Year 2014-2015.
Place: Pune
Date: 18/11/2015

Coordinator
Department Of Computer Science
Fergusson College, Pune
Project Guide:

1. ______________ 2. ______________

Examiners Name Sign

1. _______________________ ________________

2. _______________________ _____________________
Description
A binary tree is a tree data structure in which each node has at most two children, which are
referred to as the left child and the right child.

A binary tree is a mirror image of itself if its left and right subtrees are identical mirror
images i.e., the binary tree is symmetrical. This is best explained with a few examples.
1
/\
2 2
TRUE
1
/\
2 2
\
3
FALSE
Functionality
Following list of functionality our project has:
Binary tree construction
Checking whether it is symmetric or
not
Predicates Used :
add/3
symmetric/1
mirror/2

Functionality in details:

1) add/3:

A predicate to construct a binary search tree


from a list of integer numbers. add(X,T1,T2) :- the
binary dictionary T2 is obtained by adding the item X
to the binary dictionary T1(element,binary-
dictionary,binary-dictionary) (i,i,o).

2) symmetric/1 :

A binary tree is symmetric if you can draw a vertical


line through the root node and then the right subtree
is the mirror image of the left subtree. A predicate
symmetric/1 to check whether a given binary tree is
symmetric.

3) mirror/2 :

A predicate mirror/2 is used first to check whether one


tree is the mirror image of another.
Activity Diagram :

Initial state

Accept
nodes(data)

If left node is not


present
if not left
if not right child
child
Add left node Add right
node If
not right

Binary Tree

Check if left subtree is mirror


of right

[Y ]
[ N]
If leftsubtree
if not subtree
Is mirror
Print T Print F

STOP

You might also like