click the bell icon to get latest videos
from Ekeeda Hello friends in this video
we will be discussing about the next
type of data structures they are stacked
queuing binary tree now up till now what
we have studied is linear array and
linked list in the linear array we store
the data in consecutive memory location
whereas in a linked list we divide our
are node gets divided into two part
information part and then the address of
the next node now I am both the data
structure they were of linear data
structure because my data was getting
stored into a linear way or in the
linear fashion now my next data
structure is called as pre Indic tree is
a nonlinear data structure here my data
gets stored into some hierarchical or
fashion or you can say the data gets
stored into a hierarchical way now in
our syllabus we have the very nearest
tree for the study now see this this is
called as a binary tree binary tree is
defined as a set of finite set of
elements and the every element is called
as node your binary tree can be a empty
tree or I can call it as 9 3 or it gets
classified into a distinguished node t1
and t2 and my top of the node or top of
the tree is called as what root now if
you see this binary tree here my a is
called as root of the binary tree
whereas my B and C they are called as
left subtree and right subtree so your
binary tree can be classified into a
root of the tree and remaining nodes
they form the ordered pair of disjoint
binary tree t1 and t2 so here my root of
the trees a whereas B is called as even
and C is called as t2 I call them as
what
Priya right subtree if you are T 1 and T
2 if you're T 1 and T 2 if they are non
empty then I can call them as left
successor and right successor now in
this particular diagram might both be T
1 and T 2 are non empty so I call them
as left successor are right successor
now in this binary tree there are total
11 elements into it so I can say the
total number of nodes in the above I'm
Eretria level here child of the same
parents are called as sibling so de G H
they are the siblings because D and E
are the child of same parent B where a G
and H are the size child of same parent
called as C the node with the no
successor are called as terminal node
here D F G K they are with no successor
so I can call them as terminal node or I
can call them as Liv
now the line drawn from your parent to
child is called as H and the sequence of
this edges is called a spot for an
example is a parent sees a child so
lying between a and C I will call this H
this sequence of all ages is nothing but
your path now next what we have to study
is depth of the binary tree the path
which contains maximum number of nodes
into it is your depth of the binary tree
for example if you see this in this path
there are 4 nodes in c h k then I have
one more path AC h J M here I have I was
having four nodes in this part I am
having find out if you calculate the
other path also you will get you know
that this path is the longest path which
is having five nodes into it so the
depth of this binary tree is called a
depth of this family tree is going to be
a fight now next we have to study how to
draw a binary tree with the given
expression now suppose if my expression
is a minus B divided by C into D plus E
then how to draw a binary tree for the
amount given expression we have to
identify the relationship between every
element for an example now a and B both
are joined with the minus sign C and D
both are joined with the multiplication
sign and C and D both are joined with E
with the plus sign so I will be drawing
the binary tree something like this for
the above expression a minus B C into B
C into D both are joined by plus sign so
C into D plus E and in this by this is
my left subtree this is my right subtree
my left and right subtree both are
joining with the division sign so in the
above I era tree my division is root of
the tree or I can call it as top node of
the tree where as minus and plus they
are my left subtree and right subtree
respectively since they are non-empty I
can call them as left successor and
right successor of the tree in this
binary tree the depth is going to be a 4
because the longest path contains
maximum for node ignores in doing 1 2 3
4 1 2 3 1 2 3 4 so the longest path has
maximum 4 nodes into it so the depth of
this binary tree is nothing but what
sign here a b c d e they can be called
as leaf or they can be called as
terminal dot since they don't have any
successor and a b c d multiplication and
e they are called as child they are
called as sibling because they are child
of same parent so i hope you have
understood the concept of binary tree
now next we will
to the stack and you stack and queue
again at the data structure but in this
data structure the data gets stored into
some different way
first we will concentrate on this stack
this term data structure is always
closed with the one end and it is open
only at the top so I can say the
insertion and deletion of an element in
this stat takes place only at the one
end called as top of this stack in top
of this stack the item the push is the
term used to insert a limit into a stack
whereas pop is the term used to delete
element from this stack so suppose if
this is this stack then this is how I
will be inserting element into a stack
and this is how I will be deleting the
element into a stack so it means the
element which is inserted last that is
going to be a remove first so I called
it as what last in first out last in
first out means the item which is
inserted last that will get removed
first why it so because it is closed at
the other end
so obviously the element which I
inserted last that will get out first
now the next data structure is called as
q q is also got nest FIFO FIFO means
first in first out so the item which is
inserted first that we need to remove
first the example of the queue you can
take it as what the queue waiting for a
bus at bus stop the person which has
approached or which has come into the
queue at the first obviously he will be
getting or he will be boarding the bus
first so I will call it as what FIFO in
the queue
insertion and deletion expressed from
the both the edge means insertion
expressed from the one a
whereas deletion takes place from the
other end so these are stack and queue
these are the again
the types of data structure thanks for
watching this video thank you
