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)
61 views
6 pages
Data Structures Alex Final Exam 2022
data structure exam
Uploaded by
abdalrahmantouny63
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 now
Download
Save Data Structures Alex Final Exam 2022 For Later
Download
Save
Save Data Structures Alex Final Exam 2022 For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
61 views
6 pages
Data Structures Alex Final Exam 2022
data structure exam
Uploaded by
abdalrahmantouny63
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 now
Download
Save Data Structures Alex Final Exam 2022 For Later
Carousel Previous
Carousel Next
Download
Save
Save Data Structures Alex Final Exam 2022 For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 6
Search
Fullscreen
robe Gel casio a irae ern Sed tnat/aead RIES A Churse Code: 108 Course: Data Structures and se; Data Structures and Algorithms ALEXANDRIA Time alowed: 20minutes Total polns: opelnts nena ‘Professor(s) name(s): Professor Dr, Ossama Ismail and Dr. M. ELHabrouk ‘ — ‘AMteMps ALL the following questions Cchoose the MOST APPROPRIATE answer forthe following statements ‘You may choose & (ALL) if all answers (A, 8, C and 0) are corrector choose F (ONE) none ofthe answers fs lease write your answers on the ANSWER SHEET ONLY. Inthe designated answer sheet, mark your choice (9, ©, ©, ‘Be sure that you have filed the approptlate bubbles carefully asin the example below. Example; ifthe cholee for question 300s "C" then your answer sheet should Took ike this: 300. © © @ © 1. Cana tree be stored in an array usin ether one of i-order or post-order or pre-order tra 12) Yes just traverse through the array and form the tree ) No in case of sparse trees etsfo we need one more traversal to form atree €) Yes by using both in-order » s Thee tollowing ines talks about deleting a node na binary ree (the tree property must note WS deletion }) from root search for the node to be deleted i) delete the node at what must be statement i) and the fil-up of statement i)? p)ilfind random node, replace with node to be deleted P b)ii}find node to be deleted found location Un ilind deepest node, replace with node to be deleted Ti delete a node a eclee eae rene winpacetotacened — aMrcnsagiec Se node eesrint minror of tree, showin below as an exa™o\s? as an example 3, What must be the missing code logic below s0 2° The swapping of eft & right nodes to print mirror of 2 tres (rootnede) + // missing code end 2) swapping of left and right nodes is missing. Pe b) swapping of left with root nodes is missing @
Which ofthe folowing statements is correct? Page 40f6[a The pivot could be either th ither the 7 oF the 9, 6. The pit snot the 7, butt could be b. The pivot could be the, butitisnotthe9 4 Netter the 7ror the 9 ae 4. i fe fing Y Which of the following sorting algorithms In Is typical implementation gives best performance when applied on an array ‘hich is sorted or almost sorted (maximum 1 or two elements are misplaced) : x : Quick Sort b, Heap Sort Merge Sort Ainsertion Sort sume that we use Bubble Sort to sort n distinct elements in ascending order. When does the best case of Bubble Sort occur? AiWihen elements are sorted in ascending order c. When elements are not sorted by any order ’. When elements are sorted in descending order _d, There is no best case for Bubble Sort. It always takes O[n*n} time 56. Consider an array of elements arr5]= (5,4,3,2,4}, what are the steps of insertions done while doing insertion sortn the array. 45321,34521,23451,12345 b.54312,54123,51234,12345 57. Which is the correct order ofthe following algorithms with respect to their time complex! 1a. Merge sort> Quick sort >insertion sort> selection sort _¢: Merge sort selections Winsertion sort < Quick sort < Merge sort
Quick sort > selection sort ins 58. A sorting technique is called stable f. 643215,32154,21543,15432 .45321,23451,34521,12345 ty inthe best case ? sart > quick sort > Insertion sort It uses divide and conquer paradigm 2. t takes O(n log njtime 4 It takes O(n) space “adit maintains the relative order oforeurrenc of non-distnct elements ste minimum numberof S368? a. Quick sort Biisertion sort Selection sort d, Heap so A Greedy method b, Divide-and-conquer ¢, Dynamic Programming 4. a. Priority queue ASingle ended queue c.clrcularqueue 4. ordinary a 2.0in) b.0{n"2) In toxin!) O(n) 4E.0(0"2) c. O(n * logial) 66. ini 1e worst-case scenario, suck sort has a time complexity oF s Ore on coseemy 00% ye eae ce fpcwan) #080 Fie lexity of AB verage -case scenario, bubble sort thas a time complexity of ‘hes ee ae ea ‘oin*2) ¢, On * login) 4, 0(28n) Cee ora “otnviay O(n) _ yns2) cc. O(n * login)! ol one Be Be ne? to simulate Dynamic Arrays 73,/arhich ofthe following can be done with tion of tacks and Queues ry Trees ich a Linkedtis's Nod! fit exists ‘implementation of Data Structures thatcaN 4. (a)and (b) je must store?
Left-» Root Right -> Root» tap Aieft>Right-> Root —_b, Left > Root -> Right 76, What is/are the disadvantages of Implementing tree us!ng normal arrays? a) difficulty in knowing children’s nodes of a node ¢) difficult In finding the parent of a node AMfhave to know the maximum number of nodes possible before creation of trees 4) dif 0 implement 77, What must be the Ideal size of array if the height of a BST Is 7 Aa bl dl o)2i 78. Where is the parent for a node ‘w’ of a complete binary tree in an array. ‘representation when wis not 0? A iloortw-1/2) b)celllw-t/2) c)wet/2 w/a 73, Disadvantages of linked lst representation of binary trees over arrays? Al! ‘a) Randomly accessing is not possible ) Extra memory for a pointer Is needed with every element in the lst 'b) Difficulty in deletion d) Random access is nat possible and extra memory with every element 80. The main operations performed in a binary tree are " A insertion, deletion and traversal ‘addition, deletion and traversal 'b. insertion, deletion and reversal d. addition, subtraction and traversal 81, To obtain a prefix expression, which of the tree traversals is used? a) Level-order traversal &fPre-order traversal } Postiorder traversal) In-order traversal 82, For the tree shown in the figure tothe right the in-order traversal is FOUTS 94 02.72,65,115,9,4 b) 6,5, 2, 11, 7,4,9,5,2 4)2,7,6,5, 11, 2,9,5,4 £5, The numberof edges the otto the nodes cle ofthe ey Alea depth eJiength_ eth 4 Tne numberof edge rom the node tthe depet at iscalled ella quote tes a) Height AB Depth ) Length: d) Width 45. What wl be the hghtos balanced flay Wee wth leaves? als bs 6 Ms 86, When using Dijkstra’ algorthm to faethe shortest path ina graph, which ofthe following statements in not true «It can fine the shortest path within the same path data structure PF Everytime a new node's visited we choose the rode with smallest known dstance/cost (weight to vst fst Shortest path alnays pasts through the smalest numberof vertices 6. The raph needs tohave a non-negative weight on every edge Find the shortest path from vertex 1 to vertex forthe raph shown inthe figure tothe gh, Oiksas shortest path algorithm is used 3.1223355-77989 b1223366829 6122325566089 #712233655577-489 '88, For the graph shown nthe gure to the tht, aply Dijkstra algorithm from vertex St). Which ofthe flowing statements are tue? yy 8. Thea verter acted ts The shortest path from At Lis 5 There is exactly one shortest path from Ato F. v= & 4. (a) andte) £9, Forthe above problems the cost of the shortest path fom AG, A->H and A>! isthe Me b False True under condition 4. Not Applicable 90. “Which ofthe following isthe most commonly used data structure for Implementing Ditstr’s algorithm? 7vtax prionty queve Stack ¢. Creular queue dd. Min priory queue ‘Best Wishes - Page 6 of 6
You might also like
Topic 5 Binary Tree - Updated
PDF
No ratings yet
Topic 5 Binary Tree - Updated
69 pages
Trees
PDF
No ratings yet
Trees
51 pages
Binary Search Trees: COL 106 Amit Kumar and Shweta Agrawal
PDF
No ratings yet
Binary Search Trees: COL 106 Amit Kumar and Shweta Agrawal
57 pages
DSA205 Answer Key
PDF
No ratings yet
DSA205 Answer Key
16 pages
Data Structures Module 5 Complete Solutions
PDF
No ratings yet
Data Structures Module 5 Complete Solutions
34 pages
CS - Day 2 - Programming - and - Date - Structure - Revision Through Questions
PDF
No ratings yet
CS - Day 2 - Programming - and - Date - Structure - Revision Through Questions
15 pages
Data Structures Module 4 QB Complete Solutions
PDF
No ratings yet
Data Structures Module 4 QB Complete Solutions
37 pages
Projectdoc
PDF
No ratings yet
Projectdoc
12 pages
Chapter 4 (1)
PDF
No ratings yet
Chapter 4 (1)
41 pages
Unit 5 Trees & Its Operation
PDF
No ratings yet
Unit 5 Trees & Its Operation
40 pages
MCQs On DS
PDF
No ratings yet
MCQs On DS
13 pages
10 Binary Trees
PDF
No ratings yet
10 Binary Trees
24 pages
Bst
PDF
No ratings yet
Bst
63 pages
Tree_1
PDF
No ratings yet
Tree_1
76 pages
Lec24. Binary Search Tree (BST)
PDF
No ratings yet
Lec24. Binary Search Tree (BST)
46 pages
Trees
PDF
No ratings yet
Trees
36 pages
Chapter 6
PDF
No ratings yet
Chapter 6
16 pages
Pds ch-3 Print
PDF
No ratings yet
Pds ch-3 Print
24 pages
Unit - 3 (2 Marks)
PDF
No ratings yet
Unit - 3 (2 Marks)
8 pages
3.1 Trees
PDF
No ratings yet
3.1 Trees
43 pages
sol22
PDF
No ratings yet
sol22
12 pages
Data Structures Digital Notes-121-130
PDF
No ratings yet
Data Structures Digital Notes-121-130
10 pages
HT TP: //qpa Pe R.W But .Ac .In: 2010-11 Data Structure and Algorithms
PDF
No ratings yet
HT TP: //qpa Pe R.W But .Ac .In: 2010-11 Data Structure and Algorithms
7 pages
Chapter 6 Binary Tree
PDF
No ratings yet
Chapter 6 Binary Tree
14 pages
A. 2451 B. 4950 C. 4851 D. 9900
PDF
No ratings yet
A. 2451 B. 4950 C. 4851 D. 9900
48 pages
Tree
PDF
No ratings yet
Tree
20 pages
Data Structures Final 004
PDF
No ratings yet
Data Structures Final 004
6 pages
Computer Basics
PDF
No ratings yet
Computer Basics
250 pages
Algorithm Solved Mcqs Part II
PDF
No ratings yet
Algorithm Solved Mcqs Part II
15 pages
DS Question Bank - Image.marked
PDF
No ratings yet
DS Question Bank - Image.marked
7 pages
Trees and Binary Trees
PDF
No ratings yet
Trees and Binary Trees
59 pages
Technical Question and Answers in C, C++, DS, Oracle, Unix
PDF
No ratings yet
Technical Question and Answers in C, C++, DS, Oracle, Unix
176 pages
Ds unit 5
PDF
No ratings yet
Ds unit 5
6 pages
Trees
PDF
No ratings yet
Trees
22 pages
MC7104-Data Structures and Algorithms Question Bank_edited
PDF
No ratings yet
MC7104-Data Structures and Algorithms Question Bank_edited
7 pages
Data Structure
PDF
No ratings yet
Data Structure
39 pages
Data Structure
PDF
No ratings yet
Data Structure
39 pages
ds mid 2
PDF
No ratings yet
ds mid 2
24 pages
Csce146practiceexam2 Notes
PDF
No ratings yet
Csce146practiceexam2 Notes
9 pages
ds unit 5 (1)
PDF
No ratings yet
ds unit 5 (1)
6 pages
Unit Iv Non-Linear Data Structures Syllabus
PDF
No ratings yet
Unit Iv Non-Linear Data Structures Syllabus
21 pages
os-1
PDF
No ratings yet
os-1
20 pages
67
PDF
No ratings yet
67
20 pages
Final Sanfoundry Questions
PDF
No ratings yet
Final Sanfoundry Questions
19 pages
123
PDF
No ratings yet
123
17 pages
4
PDF
No ratings yet
4
12 pages
5
PDF
No ratings yet
5
12 pages
MC7104-Data Structures and Algorithms
PDF
No ratings yet
MC7104-Data Structures and Algorithms
7 pages
Questions 1 Through 25 Are Worth 2 Points Each. Choose One Best Answer For Each
PDF
No ratings yet
Questions 1 Through 25 Are Worth 2 Points Each. Choose One Best Answer For Each
5 pages
Trees, Binary Trees, and Binary Search Trees: COMP171
PDF
No ratings yet
Trees, Binary Trees, and Binary Search Trees: COMP171
36 pages
Ds 1
PDF
No ratings yet
Ds 1
18 pages
Concepts 2023_
PDF
No ratings yet
Concepts 2023_
6 pages
conceptFinal2020(sol)
PDF
No ratings yet
conceptFinal2020(sol)
5 pages
fainl 2021 (sol)_
PDF
No ratings yet
fainl 2021 (sol)_
4 pages
COMP 302 Database Systems
PDF
No ratings yet
COMP 302 Database Systems
31 pages
Data Structutes Using C'
PDF
No ratings yet
Data Structutes Using C'
7 pages
Final 2016 Credit
PDF
No ratings yet
Final 2016 Credit
2 pages
Med
PDF
No ratings yet
Med
3 pages