SlideShare a Scribd company logo
1 of 8
Download to read offline
This question paper contains 7 printed pages]
Roll No. I I I f I I I I I I 1· I
S. No. ofQuestion Paper : 6070
Unique Paper Code : 234301
Name ofthe Paper
Name ofthe Course
Semester
: Design and Analysis ofAlgorithms (CSHT:305)
: B.Sc. (Hons.) Computer Science
: III
D
Duration :3 Hours Maximum Marks :75
(Write your Roll No. on the top immediately on receipt of this question paper) ·
Question No. 1 of 35 marks is compulsory.
Attempt any four questions from Q. No. 2 to Q. No. 7.
1·. (a) Prove that the average running time of Quicksort is O(n lg ·n) where n is the number
ofelements. 5
(b) Determine an LCS of <1, 0, 0, I, 0, 1, 0, 1> and <0, 1, 0, 1, 1, 0, 1, 1, 0>. 5
(c) Beginning with an empty red-black tree insert in succession the following keys : 5
10 20 30 80 50 70 75
From the above tree delete 20.
P.T.O.
Visit https://www.tutorialsduniya.com for Notes, books, programs, question papers with solutions etc.
Visit https://www.tutorialsduniya.com for Notes, books, programs, question papers with solutions etc.
For any query, contact us at help@tutorialsduniya.com
TutorialsD
uniya.com
,
( 2 )
(d) Consider the following recursive function:
TOH(in n, char from, char to,.char aux) .
{
if(n==I)
Cout<<"Move disk I from "<<from<<" to "<<to;
else
{
TOH (n-1, from,aux,to);
cout<<"Move disk"<<n<<" from"<<from<<"to"<<to;
TOH(n-1,aux,to,from);
}
}
6070
5
Let T(n) represents the total number of moves required to move n disks from one
tower to another. Give a recurrence relation for T(n). Find T(n) in terms of
big Oh.
Visit https://www.tutorialsduniya.com for Notes, books, programs, question papers with solutions etc.
Visit https://www.tutorialsduniya.com for Notes, books, programs, question papers with solutions etc.
For any query, contact us at help@tutorialsduniya.com
TutorialsD
uniya.com
( 3 ) 6070
(e) · Apply DFS algorithm on the following graph. Assume that adjacency lists are in
alphabetical order. Also classify the different edges as tree, forward, back and
cross edge. 5
(j) Is it always true th~t an array that is already sorted is a best-case input for sorting.
algorithms ? Give an argument or a counterexample. 3
(g) Suppose the elements in an array are (starting at index 1) 25, 19,.15, 5, 12, 4, 13,
3, 7, 10. Does this array represent a heap ? Justify your answer. 2
(h) Suppose we perform a sequence of n operations on a data structure in which the
/h operation costs i if i is an exact power of2 and 1 otherwise~ Use aggregate analysis
to determine the amortized cost per operation. 5
P.T.O.
Visit https://www.tutorialsduniya.com for Notes, books, programs, question papers with solutions etc.
Visit https://www.tutorialsduniya.com for Notes, books, programs, question papers with solutions etc.
For any query, contact us at help@tutorialsduniya.com
TutorialsD
uniya.com
I
L,
( 4 ) . 6070
2. (a) Suppose that you are given n red and n blue water jugs, all of different shapes and
sizes. All red jugs hold different amounts of water, as do the blue ones. Moreover, for
every red jug, there is a blue jug that holds the same amount of water, and vice versa.
It is yourtask to find a grouping of the jugs into pairs of red· and blue jugs that hold
the same amount of water.
To do so, you may perform the following operation : pick a pair of jugs in which
one is red and one is blue, fill the red jug with water, and then pour the wat~r
into the blue jug. This operation will tell you whether the red or the blue jug can hold
more water, or if they are of the same volume. Assurrie that such a comparison takes
one time unit. Your goal is to give an algorithm that uses O(n2) comparisons to group
the jugs into pairs. Remember that you may not directly compare two red jugs or two
blue jugs. 5
(b) Find the average/expected time taken by bucket sort to sort an array containing.
n elements. 5
3. (a) Suppose we are to find the k smallest elements in a list ofn elements, and we are not
interested in their relative order. Give a linear time algorithm for the same. 5
(h) Suppose that CONNECTED-COMPONENTS is run on the undirected graph
G = (V, E), where V = {a, b, c, d, e, j, g, h, i, j, k} and the edges of E are
processed in the following order : (d, i), if, k), (g, i), (b, g), (a, h), (i, j), (d, k),
(b, j), (d, f), (g, j), (a, e), (i, d). List the vertices in each connected component
after each iteration. 5
Visit https://www.tutorialsduniya.com for Notes, books, programs, question papers with solutions etc.
Visit https://www.tutorialsduniya.com for Notes, books, programs, question papers with solutions etc.
For any query, contact us at help@tutorialsduniya.com
TutorialsD
uniya.com
( 5 ) 6070
4. (a) Suppose that we have numbers between 1 and 50 in a red-black tree and want to
search for the number 19. Which of the following sequences could not be the sequence
of nodes examined ?
(i) 26, 28, 15, 17, 19
(ii) 35, 12, 28, 17, 19. 2
(b) Let a, b and c be arbitrary nodes m subtrees a, ~ and y respectively, in the
following figure. How do the depths ofa, b and c change when a left rotation is performed
on node x in the figure ? 3
.y
(c) What is the 'largest possible number of internal nodes in a red-black tree with
black-height k ? What is the smallest possible number of nodes ?
(d) What is an order-statistic tree ? Explain and give an example.
3
2
P.T.O.
Visit https://www.tutorialsduniya.com for Notes, books, programs, question papers with solutions etc.
Visit https://www.tutorialsduniya.com for Notes, books, programs, question papers with solutions etc.
For any query, contact us at help@tutorialsduniya.com
TutorialsD
uniya.com
( 6 ) 6070
5. (a) What is memorization? Show how this helps in increasing the efficiency ofa recursive
program. 5
(b) Not just any greedy approach to the activity-selection problem produces a maximum-
size set ofmutually compatible activities. Give an example to show that the approach
ofselecting the activity ofleast duration from those that are compatible with previously
selected activities does not work. 5
6. (a) Find the minimum spanning tree for the following graph using Kruskal's algorithm. 5
(b) A bipartite graph is a graph whose vertices may be partitioned into two subsets such
that there is no edge between any two vertices in the same subset. Write an algorithm
to find whether a given directed graph is bipartite or not. 5
. ~
Visit https://www.tutorialsduniya.com for Notes, books, programs, question papers with solutions etc.
Visit https://www.tutorialsduniya.com for Notes, books, programs, question papers with solutions etc.
For any query, contact us at help@tutorialsduniya.com
TutorialsD
uniya.com
( 7 ) 6070
7. (a) Find the failure indexes for the following pattern :
AABAACAABABA
Assume array indexes are starting from 1.
5
(b) Is Prim's minimum spanning tree algorithm a greedy algorithm? Justify your answer. Also
give running time ofthe algorithm.
5
. .
6070 7 1,200
----------------------------
Visit https://www.tutorialsduniya.com forNotes, books, programs, question papers with solutions etc.
Visit https://www.tutorialsduniya.com forNotes, books, programs, question papers with solutions etc.
For any query, contact us at help@tutorialsduniya.com
TutorialsD
uniya.com
Analysis of Algorithms Exam Paper

More Related Content

What's hot (20)

100+ run commands for windows
100+ run commands for windows 100+ run commands for windows
100+ run commands for windows
 
Algorithms Lecture 3: Analysis of Algorithms II
Algorithms Lecture 3: Analysis of Algorithms IIAlgorithms Lecture 3: Analysis of Algorithms II
Algorithms Lecture 3: Analysis of Algorithms II
 
Programming with LEX & YACC
Programming with LEX & YACCProgramming with LEX & YACC
Programming with LEX & YACC
 
Lecture 3 data structures and algorithms
Lecture 3 data structures and algorithmsLecture 3 data structures and algorithms
Lecture 3 data structures and algorithms
 
Analysis Of Algorithms - Hashing
Analysis Of Algorithms - HashingAnalysis Of Algorithms - Hashing
Analysis Of Algorithms - Hashing
 
Augmenting Data Structures
Augmenting Data StructuresAugmenting Data Structures
Augmenting Data Structures
 
Application of dfs
Application of dfsApplication of dfs
Application of dfs
 
Bruteforce algorithm
Bruteforce algorithmBruteforce algorithm
Bruteforce algorithm
 
15CS562 AI VTU Question paper
15CS562 AI VTU Question paper15CS562 AI VTU Question paper
15CS562 AI VTU Question paper
 
csesch.pdf
csesch.pdfcsesch.pdf
csesch.pdf
 
Recurrent problems: TOH, Pizza Cutting and Josephus Problems
Recurrent problems: TOH, Pizza Cutting and Josephus ProblemsRecurrent problems: TOH, Pizza Cutting and Josephus Problems
Recurrent problems: TOH, Pizza Cutting and Josephus Problems
 
Tower of hanoi
Tower of hanoiTower of hanoi
Tower of hanoi
 
Splay Tree Algorithm
Splay Tree AlgorithmSplay Tree Algorithm
Splay Tree Algorithm
 
Vertex cover Problem
Vertex cover ProblemVertex cover Problem
Vertex cover Problem
 
Unix++: Plan 9 from Bell Labs
Unix++: Plan 9 from Bell LabsUnix++: Plan 9 from Bell Labs
Unix++: Plan 9 from Bell Labs
 
Skip List
Skip ListSkip List
Skip List
 
Dfs presentation
Dfs presentationDfs presentation
Dfs presentation
 
Finite automata intro
Finite automata introFinite automata intro
Finite automata intro
 
NP Complete Problems in Graph Theory
NP Complete Problems in Graph TheoryNP Complete Problems in Graph Theory
NP Complete Problems in Graph Theory
 
Longest Common Subsequence
Longest Common SubsequenceLongest Common Subsequence
Longest Common Subsequence
 

Similar to Analysis of Algorithms Exam Paper

Ee693 sept2014midsem
Ee693 sept2014midsemEe693 sept2014midsem
Ee693 sept2014midsemGopi Saiteja
 
This quiz is open book and open notes/tutorialoutlet
This quiz is open book and open notes/tutorialoutletThis quiz is open book and open notes/tutorialoutlet
This quiz is open book and open notes/tutorialoutletBeardmore
 
Due Week 10 and worth 250 pointsIn preparation for this assignme.docx
Due Week 10 and worth 250 pointsIn preparation for this assignme.docxDue Week 10 and worth 250 pointsIn preparation for this assignme.docx
Due Week 10 and worth 250 pointsIn preparation for this assignme.docxjacksnathalie
 
Dat 305 dat305 dat 305 education for service uopstudy.com
Dat 305 dat305 dat 305 education for service   uopstudy.comDat 305 dat305 dat 305 education for service   uopstudy.com
Dat 305 dat305 dat 305 education for service uopstudy.comNewUOPCourse
 
Algorithms notes tutorials duniya
Algorithms notes   tutorials duniyaAlgorithms notes   tutorials duniya
Algorithms notes tutorials duniyaTutorialsDuniya.com
 

Similar to Analysis of Algorithms Exam Paper (20)

Algorithm Assignment Help
Algorithm Assignment HelpAlgorithm Assignment Help
Algorithm Assignment Help
 
Algorithm Homework Help
Algorithm Homework HelpAlgorithm Homework Help
Algorithm Homework Help
 
Mit6 006 f11_quiz1
Mit6 006 f11_quiz1Mit6 006 f11_quiz1
Mit6 006 f11_quiz1
 
3rd Semester Computer Science and Engineering (ACU) Question papers
3rd Semester Computer Science and Engineering  (ACU) Question papers3rd Semester Computer Science and Engineering  (ACU) Question papers
3rd Semester Computer Science and Engineering (ACU) Question papers
 
Algorithms Exam Help
Algorithms Exam HelpAlgorithms Exam Help
Algorithms Exam Help
 
Algorithm Homework Help
Algorithm Homework HelpAlgorithm Homework Help
Algorithm Homework Help
 
algo1
algo1algo1
algo1
 
MyStataLab Assignment Help
MyStataLab Assignment HelpMyStataLab Assignment Help
MyStataLab Assignment Help
 
Cwkaa 2010
Cwkaa 2010Cwkaa 2010
Cwkaa 2010
 
Ee693 sept2014midsem
Ee693 sept2014midsemEe693 sept2014midsem
Ee693 sept2014midsem
 
Adobe
AdobeAdobe
Adobe
 
This quiz is open book and open notes/tutorialoutlet
This quiz is open book and open notes/tutorialoutletThis quiz is open book and open notes/tutorialoutlet
This quiz is open book and open notes/tutorialoutlet
 
Due Week 10 and worth 250 pointsIn preparation for this assignme.docx
Due Week 10 and worth 250 pointsIn preparation for this assignme.docxDue Week 10 and worth 250 pointsIn preparation for this assignme.docx
Due Week 10 and worth 250 pointsIn preparation for this assignme.docx
 
Dat 305 dat305 dat 305 education for service uopstudy.com
Dat 305 dat305 dat 305 education for service   uopstudy.comDat 305 dat305 dat 305 education for service   uopstudy.com
Dat 305 dat305 dat 305 education for service uopstudy.com
 
Practive test 1
Practive test 1Practive test 1
Practive test 1
 
Programming Exam Help
Programming Exam Help Programming Exam Help
Programming Exam Help
 
Blinkdb
BlinkdbBlinkdb
Blinkdb
 
Algorithms notes tutorials duniya
Algorithms notes   tutorials duniyaAlgorithms notes   tutorials duniya
Algorithms notes tutorials duniya
 
Linear sorting
Linear sortingLinear sorting
Linear sorting
 
3rd Semester Computer Science and Engineering (ACU-2022) Question papers
3rd Semester Computer Science and Engineering  (ACU-2022) Question papers3rd Semester Computer Science and Engineering  (ACU-2022) Question papers
3rd Semester Computer Science and Engineering (ACU-2022) Question papers
 

More from TutorialsDuniya.com

Ba programme globalization notes Sartaz Sir Notes
Ba programme globalization notes Sartaz Sir NotesBa programme globalization notes Sartaz Sir Notes
Ba programme globalization notes Sartaz Sir NotesTutorialsDuniya.com
 
Ba programme english notes Sartaz Sir Notes
Ba programme english notes Sartaz Sir NotesBa programme english notes Sartaz Sir Notes
Ba programme english notes Sartaz Sir NotesTutorialsDuniya.com
 
DU BA programme education notes Sartaz Sir Notes
DU BA programme education notes Sartaz Sir NotesDU BA programme education notes Sartaz Sir Notes
DU BA programme education notes Sartaz Sir NotesTutorialsDuniya.com
 
Ba programme political science notes Sartaz Sir Notes
Ba programme political science notes Sartaz Sir NotesBa programme political science notes Sartaz Sir Notes
Ba programme political science notes Sartaz Sir NotesTutorialsDuniya.com
 
Ba programme history notes Sartaz Sir Notes
Ba programme history notes Sartaz Sir NotesBa programme history notes Sartaz Sir Notes
Ba programme history notes Sartaz Sir NotesTutorialsDuniya.com
 
Ba programme hindi notes Sartaz Sir Notes
Ba programme hindi notes Sartaz Sir NotesBa programme hindi notes Sartaz Sir Notes
Ba programme hindi notes Sartaz Sir NotesTutorialsDuniya.com
 
Ba programme economics notes Sartaz Sir Notes
Ba programme economics notes Sartaz Sir NotesBa programme economics notes Sartaz Sir Notes
Ba programme economics notes Sartaz Sir NotesTutorialsDuniya.com
 
Ba programme political science notes Sartaz Sir Notes
Ba programme political science notes Sartaz Sir NotesBa programme political science notes Sartaz Sir Notes
Ba programme political science notes Sartaz Sir NotesTutorialsDuniya.com
 
Ba programme human rights notes Sartaz Sir Notes
Ba programme human rights notes Sartaz Sir NotesBa programme human rights notes Sartaz Sir Notes
Ba programme human rights notes Sartaz Sir NotesTutorialsDuniya.com
 
Ba programme history notes Sartaz Sir Notes
Ba programme history notes Sartaz Sir NotesBa programme history notes Sartaz Sir Notes
Ba programme history notes Sartaz Sir NotesTutorialsDuniya.com
 
Ba programme hindi notes Sartaz Sir Notes
Ba programme hindi notes Sartaz Sir NotesBa programme hindi notes Sartaz Sir Notes
Ba programme hindi notes Sartaz Sir NotesTutorialsDuniya.com
 
BA programme education notes Sartaz Sir Notes
BA programme education notes Sartaz Sir NotesBA programme education notes Sartaz Sir Notes
BA programme education notes Sartaz Sir NotesTutorialsDuniya.com
 
Ba programme english notes Sartaz Sir Notes
Ba programme english notes Sartaz Sir NotesBa programme english notes Sartaz Sir Notes
Ba programme english notes Sartaz Sir NotesTutorialsDuniya.com
 
DU Ba programme education notes Sartaz Sir Notes
DU Ba programme education notes Sartaz Sir NotesDU Ba programme education notes Sartaz Sir Notes
DU Ba programme education notes Sartaz Sir NotesTutorialsDuniya.com
 
DU Ba programme political science notes Sartaz Sir Notes
DU Ba programme political science notes Sartaz Sir NotesDU Ba programme political science notes Sartaz Sir Notes
DU Ba programme political science notes Sartaz Sir NotesTutorialsDuniya.com
 
DU Ba programme hindi notes Sartaz Sir Notes
DU Ba programme hindi notes Sartaz Sir NotesDU Ba programme hindi notes Sartaz Sir Notes
DU Ba programme hindi notes Sartaz Sir NotesTutorialsDuniya.com
 
DU Ba programme english notes Sartaz Sir Notes
DU Ba programme english notes Sartaz Sir NotesDU Ba programme english notes Sartaz Sir Notes
DU Ba programme english notes Sartaz Sir NotesTutorialsDuniya.com
 
DU Ba programme history notes Sartaz Sir Notes
DU Ba programme history notes Sartaz Sir NotesDU Ba programme history notes Sartaz Sir Notes
DU Ba programme history notes Sartaz Sir NotesTutorialsDuniya.com
 
Computer graphics notes 4 tutorials duniya
Computer graphics notes 4   tutorials duniyaComputer graphics notes 4   tutorials duniya
Computer graphics notes 4 tutorials duniyaTutorialsDuniya.com
 

More from TutorialsDuniya.com (20)

Ba programme globalization notes Sartaz Sir Notes
Ba programme globalization notes Sartaz Sir NotesBa programme globalization notes Sartaz Sir Notes
Ba programme globalization notes Sartaz Sir Notes
 
Ba programme english notes Sartaz Sir Notes
Ba programme english notes Sartaz Sir NotesBa programme english notes Sartaz Sir Notes
Ba programme english notes Sartaz Sir Notes
 
DU BA programme education notes Sartaz Sir Notes
DU BA programme education notes Sartaz Sir NotesDU BA programme education notes Sartaz Sir Notes
DU BA programme education notes Sartaz Sir Notes
 
Ba programme political science notes Sartaz Sir Notes
Ba programme political science notes Sartaz Sir NotesBa programme political science notes Sartaz Sir Notes
Ba programme political science notes Sartaz Sir Notes
 
Ba programme history notes Sartaz Sir Notes
Ba programme history notes Sartaz Sir NotesBa programme history notes Sartaz Sir Notes
Ba programme history notes Sartaz Sir Notes
 
Ba programme hindi notes Sartaz Sir Notes
Ba programme hindi notes Sartaz Sir NotesBa programme hindi notes Sartaz Sir Notes
Ba programme hindi notes Sartaz Sir Notes
 
Ba programme economics notes Sartaz Sir Notes
Ba programme economics notes Sartaz Sir NotesBa programme economics notes Sartaz Sir Notes
Ba programme economics notes Sartaz Sir Notes
 
Ba programme political science notes Sartaz Sir Notes
Ba programme political science notes Sartaz Sir NotesBa programme political science notes Sartaz Sir Notes
Ba programme political science notes Sartaz Sir Notes
 
Ba programme human rights notes Sartaz Sir Notes
Ba programme human rights notes Sartaz Sir NotesBa programme human rights notes Sartaz Sir Notes
Ba programme human rights notes Sartaz Sir Notes
 
Ba programme history notes Sartaz Sir Notes
Ba programme history notes Sartaz Sir NotesBa programme history notes Sartaz Sir Notes
Ba programme history notes Sartaz Sir Notes
 
Ba programme hindi notes Sartaz Sir Notes
Ba programme hindi notes Sartaz Sir NotesBa programme hindi notes Sartaz Sir Notes
Ba programme hindi notes Sartaz Sir Notes
 
BA programme education notes Sartaz Sir Notes
BA programme education notes Sartaz Sir NotesBA programme education notes Sartaz Sir Notes
BA programme education notes Sartaz Sir Notes
 
Ba programme english notes Sartaz Sir Notes
Ba programme english notes Sartaz Sir NotesBa programme english notes Sartaz Sir Notes
Ba programme english notes Sartaz Sir Notes
 
DU Ba programme education notes Sartaz Sir Notes
DU Ba programme education notes Sartaz Sir NotesDU Ba programme education notes Sartaz Sir Notes
DU Ba programme education notes Sartaz Sir Notes
 
DU Ba programme political science notes Sartaz Sir Notes
DU Ba programme political science notes Sartaz Sir NotesDU Ba programme political science notes Sartaz Sir Notes
DU Ba programme political science notes Sartaz Sir Notes
 
DU Ba programme hindi notes Sartaz Sir Notes
DU Ba programme hindi notes Sartaz Sir NotesDU Ba programme hindi notes Sartaz Sir Notes
DU Ba programme hindi notes Sartaz Sir Notes
 
DU Ba programme english notes Sartaz Sir Notes
DU Ba programme english notes Sartaz Sir NotesDU Ba programme english notes Sartaz Sir Notes
DU Ba programme english notes Sartaz Sir Notes
 
DU Ba programme history notes Sartaz Sir Notes
DU Ba programme history notes Sartaz Sir NotesDU Ba programme history notes Sartaz Sir Notes
DU Ba programme history notes Sartaz Sir Notes
 
Computer graphics notes 4 tutorials duniya
Computer graphics notes 4   tutorials duniyaComputer graphics notes 4   tutorials duniya
Computer graphics notes 4 tutorials duniya
 
C++ notes 2 tutorials duniya
C++ notes 2   tutorials duniyaC++ notes 2   tutorials duniya
C++ notes 2 tutorials duniya
 

Recently uploaded

main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidNikhilNagaraju
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxvipinkmenon1
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝soniya singh
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learningmisbanausheenparvam
 
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
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxbritheesh05
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLDeelipZope
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 

Recently uploaded (20)

main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfid
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptx
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learning
 
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
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptx
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCL
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 

Analysis of Algorithms Exam Paper

  • 1. This question paper contains 7 printed pages] Roll No. I I I f I I I I I I 1· I S. No. ofQuestion Paper : 6070 Unique Paper Code : 234301 Name ofthe Paper Name ofthe Course Semester : Design and Analysis ofAlgorithms (CSHT:305) : B.Sc. (Hons.) Computer Science : III D Duration :3 Hours Maximum Marks :75 (Write your Roll No. on the top immediately on receipt of this question paper) · Question No. 1 of 35 marks is compulsory. Attempt any four questions from Q. No. 2 to Q. No. 7. 1·. (a) Prove that the average running time of Quicksort is O(n lg ·n) where n is the number ofelements. 5 (b) Determine an LCS of <1, 0, 0, I, 0, 1, 0, 1> and <0, 1, 0, 1, 1, 0, 1, 1, 0>. 5 (c) Beginning with an empty red-black tree insert in succession the following keys : 5 10 20 30 80 50 70 75 From the above tree delete 20. P.T.O. Visit https://www.tutorialsduniya.com for Notes, books, programs, question papers with solutions etc. Visit https://www.tutorialsduniya.com for Notes, books, programs, question papers with solutions etc. For any query, contact us at help@tutorialsduniya.com TutorialsD uniya.com
  • 2. , ( 2 ) (d) Consider the following recursive function: TOH(in n, char from, char to,.char aux) . { if(n==I) Cout<<"Move disk I from "<<from<<" to "<<to; else { TOH (n-1, from,aux,to); cout<<"Move disk"<<n<<" from"<<from<<"to"<<to; TOH(n-1,aux,to,from); } } 6070 5 Let T(n) represents the total number of moves required to move n disks from one tower to another. Give a recurrence relation for T(n). Find T(n) in terms of big Oh. Visit https://www.tutorialsduniya.com for Notes, books, programs, question papers with solutions etc. Visit https://www.tutorialsduniya.com for Notes, books, programs, question papers with solutions etc. For any query, contact us at help@tutorialsduniya.com TutorialsD uniya.com
  • 3. ( 3 ) 6070 (e) · Apply DFS algorithm on the following graph. Assume that adjacency lists are in alphabetical order. Also classify the different edges as tree, forward, back and cross edge. 5 (j) Is it always true th~t an array that is already sorted is a best-case input for sorting. algorithms ? Give an argument or a counterexample. 3 (g) Suppose the elements in an array are (starting at index 1) 25, 19,.15, 5, 12, 4, 13, 3, 7, 10. Does this array represent a heap ? Justify your answer. 2 (h) Suppose we perform a sequence of n operations on a data structure in which the /h operation costs i if i is an exact power of2 and 1 otherwise~ Use aggregate analysis to determine the amortized cost per operation. 5 P.T.O. Visit https://www.tutorialsduniya.com for Notes, books, programs, question papers with solutions etc. Visit https://www.tutorialsduniya.com for Notes, books, programs, question papers with solutions etc. For any query, contact us at help@tutorialsduniya.com TutorialsD uniya.com
  • 4. I L, ( 4 ) . 6070 2. (a) Suppose that you are given n red and n blue water jugs, all of different shapes and sizes. All red jugs hold different amounts of water, as do the blue ones. Moreover, for every red jug, there is a blue jug that holds the same amount of water, and vice versa. It is yourtask to find a grouping of the jugs into pairs of red· and blue jugs that hold the same amount of water. To do so, you may perform the following operation : pick a pair of jugs in which one is red and one is blue, fill the red jug with water, and then pour the wat~r into the blue jug. This operation will tell you whether the red or the blue jug can hold more water, or if they are of the same volume. Assurrie that such a comparison takes one time unit. Your goal is to give an algorithm that uses O(n2) comparisons to group the jugs into pairs. Remember that you may not directly compare two red jugs or two blue jugs. 5 (b) Find the average/expected time taken by bucket sort to sort an array containing. n elements. 5 3. (a) Suppose we are to find the k smallest elements in a list ofn elements, and we are not interested in their relative order. Give a linear time algorithm for the same. 5 (h) Suppose that CONNECTED-COMPONENTS is run on the undirected graph G = (V, E), where V = {a, b, c, d, e, j, g, h, i, j, k} and the edges of E are processed in the following order : (d, i), if, k), (g, i), (b, g), (a, h), (i, j), (d, k), (b, j), (d, f), (g, j), (a, e), (i, d). List the vertices in each connected component after each iteration. 5 Visit https://www.tutorialsduniya.com for Notes, books, programs, question papers with solutions etc. Visit https://www.tutorialsduniya.com for Notes, books, programs, question papers with solutions etc. For any query, contact us at help@tutorialsduniya.com TutorialsD uniya.com
  • 5. ( 5 ) 6070 4. (a) Suppose that we have numbers between 1 and 50 in a red-black tree and want to search for the number 19. Which of the following sequences could not be the sequence of nodes examined ? (i) 26, 28, 15, 17, 19 (ii) 35, 12, 28, 17, 19. 2 (b) Let a, b and c be arbitrary nodes m subtrees a, ~ and y respectively, in the following figure. How do the depths ofa, b and c change when a left rotation is performed on node x in the figure ? 3 .y (c) What is the 'largest possible number of internal nodes in a red-black tree with black-height k ? What is the smallest possible number of nodes ? (d) What is an order-statistic tree ? Explain and give an example. 3 2 P.T.O. Visit https://www.tutorialsduniya.com for Notes, books, programs, question papers with solutions etc. Visit https://www.tutorialsduniya.com for Notes, books, programs, question papers with solutions etc. For any query, contact us at help@tutorialsduniya.com TutorialsD uniya.com
  • 6. ( 6 ) 6070 5. (a) What is memorization? Show how this helps in increasing the efficiency ofa recursive program. 5 (b) Not just any greedy approach to the activity-selection problem produces a maximum- size set ofmutually compatible activities. Give an example to show that the approach ofselecting the activity ofleast duration from those that are compatible with previously selected activities does not work. 5 6. (a) Find the minimum spanning tree for the following graph using Kruskal's algorithm. 5 (b) A bipartite graph is a graph whose vertices may be partitioned into two subsets such that there is no edge between any two vertices in the same subset. Write an algorithm to find whether a given directed graph is bipartite or not. 5 . ~ Visit https://www.tutorialsduniya.com for Notes, books, programs, question papers with solutions etc. Visit https://www.tutorialsduniya.com for Notes, books, programs, question papers with solutions etc. For any query, contact us at help@tutorialsduniya.com TutorialsD uniya.com
  • 7. ( 7 ) 6070 7. (a) Find the failure indexes for the following pattern : AABAACAABABA Assume array indexes are starting from 1. 5 (b) Is Prim's minimum spanning tree algorithm a greedy algorithm? Justify your answer. Also give running time ofthe algorithm. 5 . . 6070 7 1,200 ---------------------------- Visit https://www.tutorialsduniya.com forNotes, books, programs, question papers with solutions etc. Visit https://www.tutorialsduniya.com forNotes, books, programs, question papers with solutions etc. For any query, contact us at help@tutorialsduniya.com TutorialsD uniya.com