Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
81 views
34 pages
DSA 2019 Solution
Dsa solution
Uploaded by
Safaruzzaman Shovo
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download
Save
Save DSA-2019-solution For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
0 ratings
0% found this document useful (0 votes)
81 views
34 pages
DSA 2019 Solution
Dsa solution
Uploaded by
Safaruzzaman Shovo
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Carousel Previous
Carousel Next
Download
Save
Save DSA-2019-solution For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
Download
Save DSA-2019-solution For Later
You are on page 1
/ 34
Search
Fullscreen
University of Dhaka is eo. Affiliated Engineéring Colleges Department of Computer Science and Engineering | 2" Year 1" Semester Final Examination 2019 We CSE 303: Dati Structure 7 Marks 70, sats “ mai Hours Answer any 5 of the following question: eat oe lst Lat . . fay All sacs ace lists But ail Tiss are HOI stacks"-Explain this statement with 2 example | LF Show all te steps to evalae the (llowitig postfix expréssion using posix: 2 ‘expression evaluating algorithin: | ABC+*CBA-+* assume, A SEF Convert the following infix expression into its equivalent postfix expression, 6 i) (A#B)*C-(D-E) (F+G) | . ii) A+B*(C-D)(P-R) poe 48), Write Algorithms) to perform PUSH and POP operations fora Stack an 4 array based structure, i ‘ a ‘Consider a circular queue with 8 meni locations, What will be the states of = § ‘queue in order'to perférm the followirig operat Initially empty. *"'5,7,10 and 3 inserted, Sand 7 deleted. * 4,12,15 and 20 inserted,. v. 10,3 and deleted. vi, 17 and 23 insertéd, vii," 12,15 and 20 deleted, __ PF, Explain stack and quée with example, Write dovn an algorithm which 5 ‘PUSHes‘t ‘onto a'stock: 7 Using algorithms translate to postix expression and evaluate the following 4 infix expression: % P=12/(7-3)#2*(1+5)-° 3. (a) Whatis linked list? Explain different types of linked list with pictorial view. 4 (0) Write some differences between linked list and 2 (© Write an algorithm to perform the following o} 6 i) Searching a node from a linked list" ii) Create a Circular linked list i (@) State some applications of linked list, = . 1 4. (a) What will be the depth of a complete binary treé which has 3000 nodes? 2 ()_ Howa binary Tree can be stored in computer memory using array? Explain 4 with example. . (©) Suppose the following sequences list the nodes of binary treé Tin preorder 4 and inorder respectively: . Preorder: A,HE,F,G,B,D,C,LR,P,Q Inorder : RH,D.EP,GA,F.CKB.Q Draw the diagram of the tree (@ Consider the following tree 4 aN MN o™ ON oN aN \ “fie tor? F Scanned with CamStes be ae s List the node sequence that will be \raversed when we use (j) Inorder (ii) Preorder. (iii) Postorder traversal technique: . AX fay Define Heap. Write down the pro} pertics of max-heap and min-heap with 5 example, : Construct a max heap from the given set of elements by showing éich'stepof Construction {26,33,19,15,7,35,17,10)- _. AY Insert (36) ini the resultant Max-heap. sete vate sic. AF Show each.step of the Heap sort over tho resultant May-heap. (ACRE, Wats bash function? tlastrate tree popular Hash funstion, an PF What is Hash Collision? Describe enaining iiethod that is used forhash {"". collision Resolution, ’ onan EF Show the steps in bubble sort algorithm for the following data: 4 "39,52,29°81,67,22;15,59 eM mas 2 Tad §@F “Write selection sor algorithm and explain it with example, 3 4 BY Define the following terms with ai exampl 3 raph and (iii) Strongly connected Graph 7 pr Drae the,graph from the following adjac ency list Node Adjacent list ]° 1 56,7 * 49 7.8 [25 149 1,10 i TTT Find:th followingsin:. ea oe the Adjacency matri: i ite aii, a one ix of the Graph, iv DFS and BFS of the Graph., = « t \. ; S > Chae ang, 6 t 7 1 A ‘ .& e 4 “y 1 % t ® wv 4 % 2 2 at. 4. ‘Scanned with CamScannerA(b) ABC+*KCBA-+* given, Az}, 2%, C=3 Step-t + RU sh Q) 7 push Q) 7 push(s) : Hear vor | | pop (2) puch +2 25 5 \ 1 Step—> por (5) | poet) gush (5% ) GF \s\Shep — 4", push) push(2) push(\) Step -5 gop) \s| a eee) 3 push (2-1) =| \3| Stop 6 pop (1) \5\ gor (2) push (5-1) 2Y \3] 5 -tE pop (4) =“ ope U push (4* 3) = 2.0 \,5| The resulbis 20. Tee yo —© D prox view) - ar(a (ea) /0-9) = x (8(es)*@8)/) = ASG Qa) /* = Ag ep-*Q-R) [+ = AGED-* PR-/t D xe) -0-£)" (8) = (ein)*e 0-090)" . (es) ex) ~ (o-£) (+4) ") - (aver) -(@-£) (r+6)") = AS+CK (b-£) (F+6)" - - AB+e® DEX (F+4)* - = ABrCKDE- FG+*-1 (dD ee PUSH: Adds an Mem bo tye staal. Th the slack is full tn V4 is saad -\o be am Ovens\ow condition . begin prtocadurre if slack Vs dull retunn nul end} ele \nonament op stocl| +05) assign vane end alse ans pro cadre,; Pops Ramoves an Ve rom tha back.. Tre. thems One popeed: in she raverceed ora in akich thoy One pushed of Aha dack is empty stam it \s said -lo be an Ordonett ova condition : Agorirtben fon pop: begin prroeedune if stack is amply neteotn mul) end \S else Sone value af stack (09) deoramunt wp return value end else end prrocediang2) sxe pd the airnevlon queue ls 2° @ TuRally The queue \s empty oo 2 Me oe daontt = neat = | ® ye 5, %, \0,9 - front = © ere Ddleting 5,t. cut ce Be PTT trond = b Toan > %Q Gnsescting 410,15, 20 ~ v Or ake 3 Ws a Bt yo} &@ | 4% | to fd | 20 * ponte Bh. Roos F Qg Deleting (0, 8,4 v ON 0 8 et i iat, 12 | 15 | 20 ay Sionts 5 & Toanr co Ft ) Ansar 4 \q, 2 Ort B s u : 6 + eT bte Neate GB & Near = \ Deleting \2,\5, 2 vy Anon ten 0 & Reo eh2G) Slaeks Stack Vs a Vimar dele strcehine onieh dollows Qa pant olan ondare tn aie he opertalions OF porrbrenad : “We ondon maybe LIFO (las! hn Pra Oel) on FILO (Finst In Last Out) eram@e’ Considering mary ples Seecked oven one. anodthen in ctha gontean Thx plate Dich is atthe top 's ts fad one to ba ramoved . The plata akidh has been raed ak tre bottom - nest position amains ‘inthe stack don, the longest pertiod ot dime. $0, i+ Com be ghygly sean to Sulla LEO (Last in Fret Out) on PiLo(frst In Last Out) onda.fltoas a partoulan onder in whieh he opartastions ange garforemed Thea ordon ts FIFO (Frs4 In Fret out) . @xarple> Any Queue ae Gon sumans dora rwsourtes ahora she Consummen thot Carns. inst \s sonved hast. Sree A queue is Vian Hrneture ahich he Srdrlanan: bodereon Socks and Qyuaues \g We in Remon Gy a shek Remove =the thon the mosh ruemnity altel, Wa quent, We Namove ‘tem We \ates} a natal aa?Algorittm Jor_gush’ begin prrocgduree if stack is dull relunn nul ete else. increment top Heale{ top] a. ssign va\Va end al $e end pro egdune2(e) P= tn /@-a)r 2A Gas) . (AG 9) /) 2* (145) ° (a(#-9)/)-+(2 (1+5)*) > (RE) +GO49*®) = (ap\-1) + @l8**) x (Aste) HICat 5+ 9)Evaluate * Sep-1 push (@) 6 push @) + push (®) te Sep -2 op?) pools) Lal qush(a-9) <4 |] ty ; Step - 3 gop (y) pe plz) UI push (ws) 23 \,| Sep, push GQ) —— puch) | 4 push (5) unud pps) . pep) LI push(i+8) =C E] Step-¢! pop Ce) pp(2) | 5) push (2*¢) 7 |: Slep-t; por yr) pr (2) L| push (3nd) -15 ls] The rasul} \s 5.le) Pre-orders AH EF, Gq 30, TR, ~ g bi cabee ae Cr—ordor RH, DEP G, ALP, & {6g| i| © © Dw | ae | © Srondor: DB FE ALNC, [ee — CD Pe ondin : A, 3), &,f, Go WLM, K,N Yosh ondont y e EB, &, LM, 3 Ny, \, We A426,99 19,15,4, 25, 1F,10Y Salt S-2' S-3 sou) = Grsoak 26, Gnsent 33 7 BO>2’ ~ go swap 26 and 83 Snort 19 - @3 @&) Enserct \w, @SB) Great F, @3) Gy G © S-C} (nsent OS - ee >) Ges DD) © 6 @ Bey 19.) swap. BSand \9 BS 8%, Sap 25 and 22[S33 Gneontt V7, au2 > 15, s8ap BC amd 1, ~ 5) Gs) @D. 6 o©©® @ CG & HL>2B, Swap 36 and 26, 3) 3) 33 a OO WO CY & BC> BS, soap 2 and 25 , OQ GH H 9 VY © wD\ 9,9) 4.5 £28 oe | S41 Deleting 96, 25 > 33. amd B57 \5 , sap BE and IF,WH, 26, sep Wand IT | 38 | Gey G3) (99 G@ io) 26<93 amd 19<95, SMap 33 and Jo,salen IF end 9710 , Sap Sand 10, S81 Deleting 33, A Y © & 26719 and 26719 , $Map 26 amd 17! & . WD © © O©® a ee Galilee 8! 25 Lledo Te Ts Lee ls3]95|26(i se Deleting 2k, F<19 amd «9710, SMep 19 andlo, SB. Ddleting 12, @® @ A> le and |#>F, Sap Itandt\S>F , sWap Ht amd 15 GR (5) © @ \ 2. 9 4|eg t8 % pe podels [ee ele Ted Sh Deleting H, Oo WY Iep}o and FSIT sap F and 15, 1 2 e\r% 6 +39 (ie [ee le [2 20 ler]oe] ($-7) Deleting \y, joo 4 5 6) F 8 [> fe ls [7 Le [ne (29 [os [96] ie Deleting q , to § 5.6 Ft? PDh eb blsL®© S-o0} to |p 9 [safes Ja [eF]o2 |e Tsp | ts 1 [oe Proper] [er pa] is [9 | tF fs Vn fe 9 bras pel Teale We [62 ppeee ll1 1 BpREREDSH > BEER + BERL seeks 5 SEEREE 8 ele bslol. 59) +2 |i] [3]Bal 1] $27 [Pe o[so]r [= [is oles Ter) (\ folplabelsTele# [ar] feo (eoleele tee saa] ‘eo [eplso laa 1s2 ls Tm Ve 1 ‘ 24 alsa balssler | sh 4 pels keller eo Dbl kEmale TT 1 Topple ole] tee [aoe] wleslsalvolerl 4 J alas [ale] eI a- $ f:o rao lan ome # Let 1 i Taleo Ee i Lv Vor [sl 2 paypal ler | At ErbPRbiel wlspaleloferl a 1 cs 12d oe / EERE Epp bles | $-6' ie oleae oce Selection Sent Algorithm: Oe | Selection Sont (Connery, size) repeat (ize=1) mes sete dust unsorted clement as the rinlnuen fo cocks of he angonted cloments i deront aurrcent Minimum set element) as New Wialmum $aap minimum wth Sask uncorted position end selechon sont example. 2, le, lS ,% $-0 \ vo \nye le lta) OU) Adjnacency matte od the graph! i| @ Li) Guanes [flit Ws, 1% ¥ Vis} ” us ; ‘sited: 7 56,4, 4,9; 10, % ; 7 10, 32,8 DEST shack: NEMA IM BEE # Nish 5 1,9, 48, 8 | Ae ®, G
You might also like
DSA Hand Written Notes
PDF
86% (7)
DSA Hand Written Notes
32 pages
DSA Notes MAKAUT 3rd Sem
PDF
No ratings yet
DSA Notes MAKAUT 3rd Sem
13 pages
Recording
PDF
No ratings yet
Recording
48 pages
Chapter 2 (DS)
PDF
No ratings yet
Chapter 2 (DS)
50 pages
Maha Revision DSA Gate Wallah
PDF
No ratings yet
Maha Revision DSA Gate Wallah
71 pages
Unit 3 Data Structures Notes
PDF
No ratings yet
Unit 3 Data Structures Notes
46 pages
DS Assignment - 4
PDF
No ratings yet
DS Assignment - 4
10 pages
DSA Solved Paper (May - June 2023) PDF
PDF
No ratings yet
DSA Solved Paper (May - June 2023) PDF
27 pages
DEC 2022 DSA Solution
PDF
No ratings yet
DEC 2022 DSA Solution
21 pages
Ceminihbhbhbyhb
PDF
No ratings yet
Ceminihbhbhbyhb
19 pages
Errola Dsa Note 21-03-24
PDF
No ratings yet
Errola Dsa Note 21-03-24
64 pages
Dsfs Record
PDF
No ratings yet
Dsfs Record
114 pages
Unit 2
PDF
No ratings yet
Unit 2
30 pages
Data Structure Using C Hand Written Notes
PDF
No ratings yet
Data Structure Using C Hand Written Notes
70 pages
CS Practical - Compressed
PDF
No ratings yet
CS Practical - Compressed
27 pages
Daa Notes (Final)
PDF
No ratings yet
Daa Notes (Final)
41 pages
Dsa Basic
PDF
No ratings yet
Dsa Basic
23 pages
DS Module 1
PDF
No ratings yet
DS Module 1
18 pages
Implementation of Stack
PDF
No ratings yet
Implementation of Stack
11 pages
"Data Notes": Structure
PDF
No ratings yet
"Data Notes": Structure
21 pages
Ada Module 2 Part - 2
PDF
No ratings yet
Ada Module 2 Part - 2
10 pages
Flat. Assignment Answer
PDF
No ratings yet
Flat. Assignment Answer
13 pages
Daa Unit 1 Notes
PDF
No ratings yet
Daa Unit 1 Notes
45 pages
Data Structure 2
PDF
No ratings yet
Data Structure 2
50 pages
DS Unit V Handwritten Notes
PDF
No ratings yet
DS Unit V Handwritten Notes
76 pages
Fds Assignment 3 4 5
PDF
No ratings yet
Fds Assignment 3 4 5
23 pages
Data Structure
PDF
No ratings yet
Data Structure
12 pages
Stack
PDF
No ratings yet
Stack
15 pages
Freedom Writers
PDF
No ratings yet
Freedom Writers
8 pages
5 Marks Question
PDF
No ratings yet
5 Marks Question
15 pages
Dsa Imp PQ
PDF
No ratings yet
Dsa Imp PQ
9 pages
DSA
PDF
No ratings yet
DSA
28 pages
Data Structure in C
PDF
No ratings yet
Data Structure in C
13 pages
Sem IV Data Structues
PDF
No ratings yet
Sem IV Data Structues
2 pages
DSC NOTE Handwritten
PDF
No ratings yet
DSC NOTE Handwritten
9 pages
Adsa Assignment3
PDF
No ratings yet
Adsa Assignment3
14 pages
Data Structures ShortNotes
PDF
No ratings yet
Data Structures ShortNotes
15 pages
Sorting and Searching
PDF
No ratings yet
Sorting and Searching
22 pages
Important Topics
PDF
No ratings yet
Important Topics
12 pages
HSC Data-Structures
PDF
No ratings yet
HSC Data-Structures
12 pages
Data Structures and Algorithms Unit-2 Notes
PDF
No ratings yet
Data Structures and Algorithms Unit-2 Notes
24 pages
Dsa Assignment - 2002711
PDF
No ratings yet
Dsa Assignment - 2002711
6 pages
Unit 2
PDF
No ratings yet
Unit 2
15 pages
DS CS3301 Unit-4 Notes
PDF
No ratings yet
DS CS3301 Unit-4 Notes
52 pages
??? ?????
PDF
No ratings yet
??? ?????
32 pages
SCH Bcs304
PDF
No ratings yet
SCH Bcs304
25 pages
Data Structure and Algorithms
PDF
No ratings yet
Data Structure and Algorithms
7 pages
DSA
PDF
No ratings yet
DSA
40 pages
DSNotes M2
PDF
No ratings yet
DSNotes M2
18 pages
Organ: Relatronhip
PDF
No ratings yet
Organ: Relatronhip
38 pages
Dsa BCS304
PDF
No ratings yet
Dsa BCS304
29 pages
Dsa Notes Unit 5
PDF
No ratings yet
Dsa Notes Unit 5
21 pages
Dsa (PQ)
PDF
No ratings yet
Dsa (PQ)
17 pages
Semester 7 - CD Imp Notes
PDF
No ratings yet
Semester 7 - CD Imp Notes
31 pages
Data Structure Notes Part1 Csegyan
PDF
No ratings yet
Data Structure Notes Part1 Csegyan
25 pages
Dsa Short Notes
PDF
No ratings yet
Dsa Short Notes
37 pages