SlideShare une entreprise Scribd logo
1  sur  2
Télécharger pour lire hors ligne
EE693 DATA STRUCTURES AND ALGORITHMS
QUIZ-GT-1 EXAMINATION
14 OCTOBER, 2014, Time: 1 Hours
EEE Department, IIT Guwahati
NOTE: Attempt and solve all the questions. Question-1 to Question-10 are objective questions (only one choice is
correct). Use of any kind of electronic media other than calculators are strictly prohibited. If anybody finds
voiding this rule will be penalized with -10 marks penalty. Please do not forget to mention your Name and
Roll No in the paper sheet. Please tick the correct choice. All the questions are of 2 marks. For any
wrong answer penalty of -1 marks will be imposed.
Name: Roll No:
1. This is the welcome question! All the best for EE693 Quiz-1 (GT).
In a complete k-ary tree, every internal node has exactly k children or no child. The number of leaves in such a tree
with n internal nodes is
(a) nk (b) (n-1)k+1 (c) n(k-1)+1 (d) n(k-1)
2. The height of a binary tree is the maximum number of edges in any root to leaf path. The maximum number of
nodes in a binary tree of height h is:
(a) 2h
− 1 (b) 2(h−1)
− 1 (c) 2(h+1)
− 1 (d) 2 × (h + 1)
3. Postorder traversal of a given binary search tree, T produces the following sequence of keys 10, 9, 23, 22, 27, 25, 15,
50, 95, 60, 40, 29 Which one of the following sequences of keys can be the result of an in-order traversal of the tree
T?
(a) 9, 10, 15, 22, 23, 25, 27, 29, 40, 50, 60, 95
(b) 9, 10, 15, 22, 40, 50, 60, 95, 23, 25, 27, 29
(c) 29, 15, 9, 10, 25, 22, 23, 27, 40, 60, 50, 95
(d) 95, 50, 60, 40, 27, 23, 22, 25, 10, 9, 15, 29
4. Following function is supposed to calculate the maximum depth or height of a Binary tree – the number of nodes
along the longest path from the root node down to the farthest leaf node.
int maxDepth(struct node* node)
{
if (node==NULL)
return 0;
else
{
/* compute the depth of each subtree */
int lDepth = maxDepth(node->left);
int rDepth = maxDepth(node->right);
/* use the larger one */
if (lDepth > rDepth)
return X;
else return Y;
}
}
(a) X = lDepth, Y = rDepth
(b) X = lDepth + 1, Y = rDepth + 1
(c) X = lDepth - 1, Y = rDepth -1
(d) None of the above
5. Following is C like pseudo code of a function that takes a Queue as an argument, and uses a stack S to do processing.
void fun(Queue *Q)
{
Stack S; // Say it creates an empty stack S
// Run while Q is not empty
while (!isEmpty(Q))
{
// deQueue an item from Q and push the dequeued item to S
push(&S, deQueue(Q));
}
// Run while Stack S is not empty
while (!isEmpty(&S))
{
// Pop an item from S and enqueue the poppped item to Q
enQueue(Q, pop(&S));
}
}
What does the above function do in general?
(a) Removes the last from Q
(b) Keeps the Q same as it was before the call
(c) Makes Q empty
(d) Reverses the Q
6. A priority queue can efficiently implemented using which of the following data structures? Assume that the number
of insert and peek (operation to see the current highest priority item) and extraction (remove the highest priority
item) operations are almost same.
(a) Array (b) Linked List (c) Heap Data Structures (d) None of the above
7. A Priority-Queue is implemented as a Max-Heap. Initially, it has 5 elements. The level-order traversal of the heap
is given below: 10, 8, 5, 3, 2 Two new elements "1" and "7" are inserted in the heap in that order. The level-order
traversal of the heap after the insertion of the elements is:
(a) 10, 8, 7, 5, 3, 2, 1
(b) 10, 8, 7, 2, 3, 1, 5
(c) 10, 8, 7, 1, 2, 3, 5
(d) 10, 8, 7, 3, 2, 1, 5
8. Suppose implementation supports an instruction REVERSE, which reverses the order of elements on the stack, in
addition to the PUSH and POP instructions. Which one of the following statements is TRUE with respect to this
modified stack?
(a) A queue cannot be implemented using this stack.
(b) A queue can be implemented where ENQUEUE takes a single instruction and
DEQUEUE takes a sequence of two instructions.
(c) A queue can be implemented where ENQUEUE takes a sequence of three instructions
and DEQUEUE takes a single instruction.
(d) A queue can be implemented where both ENQUEUE and DEQUEUE take a single instruction each.
9. A program takes as input a balanced binary search tree with n leaf nodes and computes the value of a function g(x)
for each node x. If the cost of computing g(x) is min{no. of leaf-nodes in left-subtree of x, no. of leaf-nodes in
right-subtree of x}
then the worst-case time complexity of the program is
(a) Θ(n) (b) Θ(nLog(n)) (c) Θ(n2
) (d) Θ(n2
Log(n))
10. You are given the postorder traversal, P, of a binary search tree on the n elements 1,2,...,n. You have to determine
the unique binary search tree that has P as its postorder traversal. What is the time complexity of the most efficient
algorithm for doing this?
(a) O(Log(n)) (b) O(n) (c) O(nLog(n)) (d) None of the above
All the best for next week quiz.

Contenu connexe

Tendances

Exercise 2
Exercise 2Exercise 2
Exercise 2math126
 
Day 7 examples u6w14
Day 7 examples u6w14Day 7 examples u6w14
Day 7 examples u6w14jchartiersjsd
 
[Question Paper] Logic and Discrete Mathematics (Revised Course) [June / 2016]
[Question Paper] Logic and Discrete Mathematics (Revised Course) [June / 2016][Question Paper] Logic and Discrete Mathematics (Revised Course) [June / 2016]
[Question Paper] Logic and Discrete Mathematics (Revised Course) [June / 2016]Mumbai B.Sc.IT Study
 
Exercise set 3.7
Exercise set 3.7Exercise set 3.7
Exercise set 3.7math265
 
10 mathfinal2011review
10 mathfinal2011review10 mathfinal2011review
10 mathfinal2011reviewJoshua Gerrard
 
7th PreAlg - L47--Jan17
7th PreAlg - L47--Jan177th PreAlg - L47--Jan17
7th PreAlg - L47--Jan17jdurst65
 
March 17, 2015
March 17, 2015March 17, 2015
March 17, 2015khyps13
 
Mathematicalfoundationofcomputerscience
MathematicalfoundationofcomputerscienceMathematicalfoundationofcomputerscience
Mathematicalfoundationofcomputersciencejntuworld
 
7th pre alg -l47--jan29
7th pre alg -l47--jan297th pre alg -l47--jan29
7th pre alg -l47--jan29jdurst65
 
Algorithms explained
Algorithms explainedAlgorithms explained
Algorithms explainedPIYUSH Dubey
 
Linked list Output tracing
Linked list Output tracingLinked list Output tracing
Linked list Output tracingSamsil Arefin
 
Va ha slant.ppt worked
Va ha slant.ppt workedVa ha slant.ppt worked
Va ha slant.ppt workedJonna Ramsey
 
Increasing and decreasing functions
Increasing and decreasing functionsIncreasing and decreasing functions
Increasing and decreasing functionsKarunaGupta1982
 

Tendances (20)

Exercise 2
Exercise 2Exercise 2
Exercise 2
 
Ch8
Ch8Ch8
Ch8
 
Day 7 examples u6w14
Day 7 examples u6w14Day 7 examples u6w14
Day 7 examples u6w14
 
[Question Paper] Logic and Discrete Mathematics (Revised Course) [June / 2016]
[Question Paper] Logic and Discrete Mathematics (Revised Course) [June / 2016][Question Paper] Logic and Discrete Mathematics (Revised Course) [June / 2016]
[Question Paper] Logic and Discrete Mathematics (Revised Course) [June / 2016]
 
Exercise set 3.7
Exercise set 3.7Exercise set 3.7
Exercise set 3.7
 
10 mathfinal2011review
10 mathfinal2011review10 mathfinal2011review
10 mathfinal2011review
 
7th PreAlg - L47--Jan17
7th PreAlg - L47--Jan177th PreAlg - L47--Jan17
7th PreAlg - L47--Jan17
 
March 17, 2015
March 17, 2015March 17, 2015
March 17, 2015
 
Mathematicalfoundationofcomputerscience
MathematicalfoundationofcomputerscienceMathematicalfoundationofcomputerscience
Mathematicalfoundationofcomputerscience
 
Alg2 lesson 7-7
Alg2 lesson 7-7Alg2 lesson 7-7
Alg2 lesson 7-7
 
Alg2 lesson 7.7
Alg2 lesson 7.7Alg2 lesson 7.7
Alg2 lesson 7.7
 
7th pre alg -l47--jan29
7th pre alg -l47--jan297th pre alg -l47--jan29
7th pre alg -l47--jan29
 
Day 6 examples
Day 6 examplesDay 6 examples
Day 6 examples
 
Aplicaciones de la derivada
Aplicaciones de la derivadaAplicaciones de la derivada
Aplicaciones de la derivada
 
Functions
FunctionsFunctions
Functions
 
Aplicaciones de la derivada
Aplicaciones de la derivadaAplicaciones de la derivada
Aplicaciones de la derivada
 
Algorithms explained
Algorithms explainedAlgorithms explained
Algorithms explained
 
Linked list Output tracing
Linked list Output tracingLinked list Output tracing
Linked list Output tracing
 
Va ha slant.ppt worked
Va ha slant.ppt workedVa ha slant.ppt worked
Va ha slant.ppt worked
 
Increasing and decreasing functions
Increasing and decreasing functionsIncreasing and decreasing functions
Increasing and decreasing functions
 

En vedette (13)

2020 A
2020 A2020 A
2020 A
 
Electric Circuits Class (Solved problem set F)
Electric Circuits Class (Solved problem set F)Electric Circuits Class (Solved problem set F)
Electric Circuits Class (Solved problem set F)
 
8 dnv res0254-97 b)&c)
8 dnv res0254-97 b)&c)8 dnv res0254-97 b)&c)
8 dnv res0254-97 b)&c)
 
Tiyatro okullari-istanbul
Tiyatro okullari-istanbulTiyatro okullari-istanbul
Tiyatro okullari-istanbul
 
FRP防水工事
FRP防水工事FRP防水工事
FRP防水工事
 
保険コンサルティングのご提案
保険コンサルティングのご提案保険コンサルティングのご提案
保険コンサルティングのご提案
 
Norwegian
NorwegianNorwegian
Norwegian
 
9 rn9 variantepasocampanazárate
9 rn9 variantepasocampanazárate9 rn9 variantepasocampanazárate
9 rn9 variantepasocampanazárate
 
25 Fatwa Ulama Ahlus Sunnah Seri 2
25 Fatwa Ulama Ahlus Sunnah Seri 225 Fatwa Ulama Ahlus Sunnah Seri 2
25 Fatwa Ulama Ahlus Sunnah Seri 2
 
Arthur Yang - A1 Poster
Arthur Yang - A1 PosterArthur Yang - A1 Poster
Arthur Yang - A1 Poster
 
Jetstar in-asia
Jetstar in-asiaJetstar in-asia
Jetstar in-asia
 
Paulus Gunawan Subroto - Notaris & PPAT
Paulus Gunawan Subroto - Notaris & PPATPaulus Gunawan Subroto - Notaris & PPAT
Paulus Gunawan Subroto - Notaris & PPAT
 
Huraian tingkatan 3 Sejarah
Huraian tingkatan 3 SejarahHuraian tingkatan 3 Sejarah
Huraian tingkatan 3 Sejarah
 

Similaire à EE693 DS & Algorithms Quiz Review

Ee693 sept2014midsem
Ee693 sept2014midsemEe693 sept2014midsem
Ee693 sept2014midsemGopi Saiteja
 
Ee693 sept2014quiz1
Ee693 sept2014quiz1Ee693 sept2014quiz1
Ee693 sept2014quiz1Gopi Saiteja
 
Answers withexplanations
Answers withexplanationsAnswers withexplanations
Answers withexplanationsGopi Saiteja
 
Technical aptitude questions_e_book1
Technical aptitude questions_e_book1Technical aptitude questions_e_book1
Technical aptitude questions_e_book1Sateesh Allu
 
Ee693 questionshomework
Ee693 questionshomeworkEe693 questionshomework
Ee693 questionshomeworkGopi Saiteja
 
DSA (Data Structure and Algorithm) Questions
DSA (Data Structure and Algorithm) QuestionsDSA (Data Structure and Algorithm) Questions
DSA (Data Structure and Algorithm) QuestionsRESHAN FARAZ
 
designanalysisalgorithm_unit-v-part2.pptx
designanalysisalgorithm_unit-v-part2.pptxdesignanalysisalgorithm_unit-v-part2.pptx
designanalysisalgorithm_unit-v-part2.pptxarifimad15
 
Gssl
GsslGssl
Gsslncct
 
GATE Computer Science Solved Paper 2004
GATE Computer Science Solved Paper 2004GATE Computer Science Solved Paper 2004
GATE Computer Science Solved Paper 2004Rohit Garg
 
Advanced data structures using c++ 3
Advanced data structures using c++ 3Advanced data structures using c++ 3
Advanced data structures using c++ 3Shaili Choudhary
 
Gate Previous Years Papers
Gate Previous Years PapersGate Previous Years Papers
Gate Previous Years PapersRahul Jain
 
PVEB Tree.pptx
PVEB Tree.pptxPVEB Tree.pptx
PVEB Tree.pptxSanthosh A
 
Consider this code using the ArrayBag of Section 5.2 and the Locat.docx
Consider this code using the ArrayBag of Section 5.2 and the Locat.docxConsider this code using the ArrayBag of Section 5.2 and the Locat.docx
Consider this code using the ArrayBag of Section 5.2 and the Locat.docxmaxinesmith73660
 
Ds qb 2021 rma
Ds qb 2021 rmaDs qb 2021 rma
Ds qb 2021 rmaARAVINDRM2
 
Advance data structure & algorithm
Advance data structure & algorithmAdvance data structure & algorithm
Advance data structure & algorithmK Hari Shankar
 
Redo midterm
Redo midtermRedo midterm
Redo midtermIIUM
 

Similaire à EE693 DS & Algorithms Quiz Review (20)

Ee693 sept2014midsem
Ee693 sept2014midsemEe693 sept2014midsem
Ee693 sept2014midsem
 
Ee693 sept2014quiz1
Ee693 sept2014quiz1Ee693 sept2014quiz1
Ee693 sept2014quiz1
 
Answers withexplanations
Answers withexplanationsAnswers withexplanations
Answers withexplanations
 
Technical aptitude questions_e_book1
Technical aptitude questions_e_book1Technical aptitude questions_e_book1
Technical aptitude questions_e_book1
 
Ee693 questionshomework
Ee693 questionshomeworkEe693 questionshomework
Ee693 questionshomework
 
DSA (Data Structure and Algorithm) Questions
DSA (Data Structure and Algorithm) QuestionsDSA (Data Structure and Algorithm) Questions
DSA (Data Structure and Algorithm) Questions
 
designanalysisalgorithm_unit-v-part2.pptx
designanalysisalgorithm_unit-v-part2.pptxdesignanalysisalgorithm_unit-v-part2.pptx
designanalysisalgorithm_unit-v-part2.pptx
 
Gssl
GsslGssl
Gssl
 
ELEMENTARY DATASTRUCTURES
ELEMENTARY DATASTRUCTURESELEMENTARY DATASTRUCTURES
ELEMENTARY DATASTRUCTURES
 
GATE Computer Science Solved Paper 2004
GATE Computer Science Solved Paper 2004GATE Computer Science Solved Paper 2004
GATE Computer Science Solved Paper 2004
 
Advanced data structures using c++ 3
Advanced data structures using c++ 3Advanced data structures using c++ 3
Advanced data structures using c++ 3
 
Cs101 endsem 2014
Cs101 endsem 2014Cs101 endsem 2014
Cs101 endsem 2014
 
Gate Previous Years Papers
Gate Previous Years PapersGate Previous Years Papers
Gate Previous Years Papers
 
Gate-Cs 1993
Gate-Cs 1993Gate-Cs 1993
Gate-Cs 1993
 
PVEB Tree.pptx
PVEB Tree.pptxPVEB Tree.pptx
PVEB Tree.pptx
 
Consider this code using the ArrayBag of Section 5.2 and the Locat.docx
Consider this code using the ArrayBag of Section 5.2 and the Locat.docxConsider this code using the ArrayBag of Section 5.2 and the Locat.docx
Consider this code using the ArrayBag of Section 5.2 and the Locat.docx
 
Recursive algorithms
Recursive algorithmsRecursive algorithms
Recursive algorithms
 
Ds qb 2021 rma
Ds qb 2021 rmaDs qb 2021 rma
Ds qb 2021 rma
 
Advance data structure & algorithm
Advance data structure & algorithmAdvance data structure & algorithm
Advance data structure & algorithm
 
Redo midterm
Redo midtermRedo midterm
Redo midterm
 

Plus de Gopi Saiteja

Plus de Gopi Saiteja (20)

Trees gt(1)
Trees gt(1)Trees gt(1)
Trees gt(1)
 
Topic11 sortingandsearching
Topic11 sortingandsearchingTopic11 sortingandsearching
Topic11 sortingandsearching
 
Heapsort
HeapsortHeapsort
Heapsort
 
Hashing gt1
Hashing gt1Hashing gt1
Hashing gt1
 
Dynamic programming
Dynamic programmingDynamic programming
Dynamic programming
 
Cs105 l15-bucket radix
Cs105 l15-bucket radixCs105 l15-bucket radix
Cs105 l15-bucket radix
 
Chapter11 sorting algorithmsefficiency
Chapter11 sorting algorithmsefficiencyChapter11 sorting algorithmsefficiency
Chapter11 sorting algorithmsefficiency
 
Sorting
SortingSorting
Sorting
 
Solution(1)
Solution(1)Solution(1)
Solution(1)
 
Pthread
PthreadPthread
Pthread
 
Open mp
Open mpOpen mp
Open mp
 
Introduction
IntroductionIntroduction
Introduction
 
Cuda
CudaCuda
Cuda
 
Vector space interpretation_of_random_variables
Vector space interpretation_of_random_variablesVector space interpretation_of_random_variables
Vector space interpretation_of_random_variables
 
Statistical signal processing(1)
Statistical signal processing(1)Statistical signal processing(1)
Statistical signal processing(1)
 
Prob review
Prob reviewProb review
Prob review
 
Estimationtheory2
Estimationtheory2Estimationtheory2
Estimationtheory2
 
Estimation theory 1
Estimation theory 1Estimation theory 1
Estimation theory 1
 
Before quiz 2
Before quiz 2Before quiz 2
Before quiz 2
 
Assignment for practice
Assignment for practiceAssignment for practice
Assignment for practice
 

Dernier

Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsyncWhy does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsyncssuser2ae721
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxk795866
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfgUnit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfgsaravananr517913
 
US Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionUS Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionMebane Rash
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...Chandu841456
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptSAURABHKUMAR892774
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...asadnawaz62
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)Dr SOUNDIRARAJ N
 
lifi-technology with integration of IOT.pptx
lifi-technology with integration of IOT.pptxlifi-technology with integration of IOT.pptx
lifi-technology with integration of IOT.pptxsomshekarkn64
 
Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...121011101441
 
Earthing details of Electrical Substation
Earthing details of Electrical SubstationEarthing details of Electrical Substation
Earthing details of Electrical Substationstephanwindworld
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx959SahilShah
 

Dernier (20)

Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsyncWhy does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptx
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfgUnit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
 
US Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionUS Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of Action
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.ppt
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...
 
POWER SYSTEMS-1 Complete notes examples
POWER SYSTEMS-1 Complete notes  examplesPOWER SYSTEMS-1 Complete notes  examples
POWER SYSTEMS-1 Complete notes examples
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
 
lifi-technology with integration of IOT.pptx
lifi-technology with integration of IOT.pptxlifi-technology with integration of IOT.pptx
lifi-technology with integration of IOT.pptx
 
Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...
 
Earthing details of Electrical Substation
Earthing details of Electrical SubstationEarthing details of Electrical Substation
Earthing details of Electrical Substation
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx
 

EE693 DS & Algorithms Quiz Review

  • 1. EE693 DATA STRUCTURES AND ALGORITHMS QUIZ-GT-1 EXAMINATION 14 OCTOBER, 2014, Time: 1 Hours EEE Department, IIT Guwahati NOTE: Attempt and solve all the questions. Question-1 to Question-10 are objective questions (only one choice is correct). Use of any kind of electronic media other than calculators are strictly prohibited. If anybody finds voiding this rule will be penalized with -10 marks penalty. Please do not forget to mention your Name and Roll No in the paper sheet. Please tick the correct choice. All the questions are of 2 marks. For any wrong answer penalty of -1 marks will be imposed. Name: Roll No: 1. This is the welcome question! All the best for EE693 Quiz-1 (GT). In a complete k-ary tree, every internal node has exactly k children or no child. The number of leaves in such a tree with n internal nodes is (a) nk (b) (n-1)k+1 (c) n(k-1)+1 (d) n(k-1) 2. The height of a binary tree is the maximum number of edges in any root to leaf path. The maximum number of nodes in a binary tree of height h is: (a) 2h − 1 (b) 2(h−1) − 1 (c) 2(h+1) − 1 (d) 2 × (h + 1) 3. Postorder traversal of a given binary search tree, T produces the following sequence of keys 10, 9, 23, 22, 27, 25, 15, 50, 95, 60, 40, 29 Which one of the following sequences of keys can be the result of an in-order traversal of the tree T? (a) 9, 10, 15, 22, 23, 25, 27, 29, 40, 50, 60, 95 (b) 9, 10, 15, 22, 40, 50, 60, 95, 23, 25, 27, 29 (c) 29, 15, 9, 10, 25, 22, 23, 27, 40, 60, 50, 95 (d) 95, 50, 60, 40, 27, 23, 22, 25, 10, 9, 15, 29 4. Following function is supposed to calculate the maximum depth or height of a Binary tree – the number of nodes along the longest path from the root node down to the farthest leaf node. int maxDepth(struct node* node) { if (node==NULL) return 0; else { /* compute the depth of each subtree */ int lDepth = maxDepth(node->left); int rDepth = maxDepth(node->right); /* use the larger one */ if (lDepth > rDepth) return X; else return Y; } } (a) X = lDepth, Y = rDepth (b) X = lDepth + 1, Y = rDepth + 1 (c) X = lDepth - 1, Y = rDepth -1 (d) None of the above
  • 2. 5. Following is C like pseudo code of a function that takes a Queue as an argument, and uses a stack S to do processing. void fun(Queue *Q) { Stack S; // Say it creates an empty stack S // Run while Q is not empty while (!isEmpty(Q)) { // deQueue an item from Q and push the dequeued item to S push(&S, deQueue(Q)); } // Run while Stack S is not empty while (!isEmpty(&S)) { // Pop an item from S and enqueue the poppped item to Q enQueue(Q, pop(&S)); } } What does the above function do in general? (a) Removes the last from Q (b) Keeps the Q same as it was before the call (c) Makes Q empty (d) Reverses the Q 6. A priority queue can efficiently implemented using which of the following data structures? Assume that the number of insert and peek (operation to see the current highest priority item) and extraction (remove the highest priority item) operations are almost same. (a) Array (b) Linked List (c) Heap Data Structures (d) None of the above 7. A Priority-Queue is implemented as a Max-Heap. Initially, it has 5 elements. The level-order traversal of the heap is given below: 10, 8, 5, 3, 2 Two new elements "1" and "7" are inserted in the heap in that order. The level-order traversal of the heap after the insertion of the elements is: (a) 10, 8, 7, 5, 3, 2, 1 (b) 10, 8, 7, 2, 3, 1, 5 (c) 10, 8, 7, 1, 2, 3, 5 (d) 10, 8, 7, 3, 2, 1, 5 8. Suppose implementation supports an instruction REVERSE, which reverses the order of elements on the stack, in addition to the PUSH and POP instructions. Which one of the following statements is TRUE with respect to this modified stack? (a) A queue cannot be implemented using this stack. (b) A queue can be implemented where ENQUEUE takes a single instruction and DEQUEUE takes a sequence of two instructions. (c) A queue can be implemented where ENQUEUE takes a sequence of three instructions and DEQUEUE takes a single instruction. (d) A queue can be implemented where both ENQUEUE and DEQUEUE take a single instruction each. 9. A program takes as input a balanced binary search tree with n leaf nodes and computes the value of a function g(x) for each node x. If the cost of computing g(x) is min{no. of leaf-nodes in left-subtree of x, no. of leaf-nodes in right-subtree of x} then the worst-case time complexity of the program is (a) Θ(n) (b) Θ(nLog(n)) (c) Θ(n2 ) (d) Θ(n2 Log(n)) 10. You are given the postorder traversal, P, of a binary search tree on the n elements 1,2,...,n. You have to determine the unique binary search tree that has P as its postorder traversal. What is the time complexity of the most efficient algorithm for doing this? (a) O(Log(n)) (b) O(n) (c) O(nLog(n)) (d) None of the above All the best for next week quiz.