atiera Ase usa viethral dent gererare
WarRta! —211004 [Ara]
Motilal Nehru National Institute of Technology Allahabad
Prayagraj-211004 [India]
Department of Computer Science and Engineering
Home Assignment 5
Programme Name: B. Tech. Semester: II
Course Code: CS13101 ‘Course Name: Data Structures
Branch: Computer Science & Engineering
Instructions:
1. This is a handwritten assignment. You need to scan the written assignment and post the solution.
You can keep the hard copy for preparation of examination.
2. Last date of submission is 25/02/2022.
Q1 Construct a binary tree having the following sequences: Preorder: ABCDEFGHI
Inorder : BCAEDGHFI. Show the steps of constructing binary tree in the above example
Q2_ Define heap. What are the different kinds of heap? How is a heap represented using an
array? Create a heap with the elements 5, 13, 6, 18, 99, 4, 38,
Q3_— What is an AVL tree? Starting with an empty AVL tree perform the following sequence of
insertions: MARCH, MAY, NOVEMBER, AUGUST, APRIL, JANUARY, DECEMBER,
JULY, FEBRUARY. Draw the AVL tree following each insertion and state rotation type
is any for any insert operation.
Q4 Given a binary tree, how do you remove all the half nodes (which have only one child)?
Note that we should not touch leaves.
QS What is the difference between Dijkstra's and Prim's algorithm?
Q6 What are the differences between DFS and BFS?
In an undirected simple graph with n vertices, what is the maximum number of
edges? Self-loops are not allowed.
Page 1 of 1dé
q
1
|
|
1
a Flutes = i
ie
(1) Teale. AAR DehD
| Tool Br acpaner
I
[SA Pinel Bi rth sy clesmedt (x dhe
ent 20 Ah Gap oeleineet viandl lacedaW img to
A ae Leff sil { A\ is eq uistiree Jacl)
swab fy axiel ubtyee .
Bc
as ta
ae
TTI TIT ETP ER Ce issisiddddadddd| shricthives iio! RN Ae a es —
Heirs Hace. i i Ae" c
A a c
a
Whe rol ee ae
Aorray [i-8)(2] = Ack Ao. a. “a
1
Zi Porras [Lomi 3) = veluoe the
Portas, { ee ct oodidé
VERS
G—_@ E+
ot}
[A ree ili bic “ae 4 prens SUSae
Page No,
i
2
i)
i
e)
;
E
E
°
nm
i
ca.
feta ta
eh! f
f q vat a if < f:
Avy he ah Te,
">
VE
Pi?
D>
Ld
dij
‘>
> 1?
|
iL
AAA? 2?
|
cal AiT ; ok a
Che ak Gol
ys EM
aw ===
BAe Leia
(Taw A.
= ie a. ae
SHEP HEM sid di diddddddddddss¢
l eae ih
i a
2 | (i) free wf Bie 7
q 3
=
a
ot
s
ake
e
9
oS i iwean
Ss. a ae
; .
|,
€
G Oe ey, ir dics The mininnunss,
paths Pi D Shtewirg shee» 4
7 We €
im @
Hig LIN é
Meta baD grapss — =
aye | €
fe) at fails to De aoe he ¢
if Core =e. i id c
Aor} €
| x c
(e) Biss eames e
| C nas c
@) Sie. ton Ardell Tea Debih fivst
fiyst Seoben Fe cath. 1 ~
= Se se as
VAN in used) «
: ‘s
ea iblines ere [Here chives eve g
‘halite Predera the. ssitdl thefow's fine
c
4