Data Structures Important Questions Part 3

0
 Ques 1. Convert the following infix expression to postfix expression
(a+b*c^d)*(e+f/g)
Ans. 

Scanned symbol

Stack

Postfix expression 


(

(


a

(

a

+

(+

a

b

(+

ab

*

(+*

ab

c

(+*

abc

^

(+*^

abc

d

(+*^

abcd

)


abcd^*+

*

*

abcd^*+

(

*(

abcd^*+

e

*(

abcd^*+e

+

*(+

abcd^*+e

f

*(+

abcd^*+ef

/

*(+/

abcd^*+ef

g

*(+/

abcd^*+efg

)


abcd^*+efg/+*


Ques 2. Give any two representation of graph?What do you mean by In Degree or out degree of graph?
Ans. Graph can be represented in these two ways
1. Adjacency List
2. Adjacency Matrix

In degree - In degree of a vertex is the number of edges coming to the vertex.
Out degree - Out degree of a vertex is the number of edges which are coming out of vertex.

Post a Comment

0Comments
Post a Comment (0)