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)
25 views
2022 Algorithm
DU Question Paper
Uploaded by
Animesh Kumar
AI-enhanced title
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save 2022_Algorithm For Later
Download
Save
Save 2022_Algorithm For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
25 views
2022 Algorithm
DU Question Paper
Uploaded by
Animesh Kumar
AI-enhanced title
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save 2022_Algorithm For Later
Carousel Previous
Carousel Next
Save
Save 2022_Algorithm 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
Gb. Copy t4)acfor [bis question paper contains 10 printed pages.) Your Roll Nes eonnsn Se. No. af Question Paper: 1143 a Unique Paper Code sasaraoi Name of the Paper Design and Analysis of Algorithns Name of the Course: BS. (I) Computer Science Semester wv Duration: 3 Hours Manion Marks : 75 instructions fo 1 Write your Roll No: on the top immediatly on receipt of this question paper. 2, Question No. £ is compulsory 3. Auenmpt any four of Questions Nes. 2 to 8 1. (0) Consider the recursive algorithm as follows 19 of Insertion sort, In order to sort Afi a], we recursively sort ATL orl] and then insert Af] into the sorted array A[] ml]. Write a recurrence for the running time of this algorithm. 8 Pro.1143 2 (6) What ate the m lements in a binary heap of height BY. 2) Jima and maximum number of (©) Which of the following algorithms are stable Insertion sort, Queksort? Justify with te help of sn example. ® (@) What are these key factors that decide whether Dynamic Programming is applicable for sn ‘optimization problem or not? e (©) “The minimum spanning tree im a graph is not always unique" Justify. Give a graph with $ nodes that has two different minimum spanning tres. @ ( Would you use BFS 10 find the shortest path between two nodes én 2 weighted graph with arbitrary edge weights? Justify your answer sith the help of a graph having at least $ Vertices and at least 7 edges. ° (2) “Counting sort is 4 comparison sort algoriths,” Yes or No. Justiy your answer using the input A=64,3,2,4,1,5,2,43> @ (5) A priority queue can be implemented in two Aitferent ways using min-heap and using singly linked list in which elements are stored in sorted 1143 5 alder (Smaller values indicates higher priority) Compare the time complexity of following operations when performed on two differe implementations of priority queue. (1) Finding the highest priority element (2) Deleting the highest priority element (9) Increase the priovity of a certain element © 0) ind posible Topological sons ofthe piven directed graph, Give any four ey i) Give the worst ease for the merge algorithm to merge two sorted strays AL. 4], Blloom) (where n=k+m) and give the total number of comparisons in the worst case (in terms of 1) Merge the two sorted arrays A = [3, 7,9, 12, 14] and B= [2, 5, 6, 10] using morge algorithm. How many number of comparisons are done by the lgorthm in the above extmple? o pro.1143 4 (8) Consider the Interval Scheduling problem wherein, We ate given a resource and a set of requests cach having a start time and @ finish time, The foal is to maximize the aumiber of requests Scheled, Show that dhe following greedy siratcxy does not give an optiznal solution for the above problem. Greedy strategy: Select the request with fewest ‘number of incompatible requests, ° 2. (a) Peofessor William claims that the Qn fg») lower bound for sorting n numbers docs not apply to his ‘machine, The conttol flow of a program on his ‘machine can split three ways after a single comparison of two elements of the array a,:9, The three ways are 9, < 8) 4 = a, of a > a, Show that the professor is wrong by proving that ‘he numberof three-way comparisons requited to sort m elements is O(w len), 6 () Suppose you have aa algorthts fo find meslian of fr elements of an unsorted ray in O(n) time ia the worst ease, Now consider an implementation ‘of Quicksort where you fits find median using the above algorithm, then use median a pivot ‘What wil be the time complesityof this modified 1143 5 (Quicksort” Write down the recurrence relation to justify your time complexity (Median of elements is the element whose rank is 1/2 if mis even and itis (ntl 2 if mis bd. o 3. (a) llustrate the operation of BUILD -MAX -H EAP on the array A <4, 3,17, 10, 28, 19, 6 12, 7 Wirite down the total number of comparisons done bby BUILD -MAX -t1 EAP, © (©) Consider the following recursive relation for 0-1 knapsack problem, Iw ew, then OPTi,w) = OPT(-1,¥) else OPT, W) = max(OPT(-1,w), ¥, + OPTI, > where OPT(,w) denote the value of the optimal solution using a subset of items (1,2yi} with rmakimum allowed weight w. ¥; fe the cost of ith stem Fl the missing vale, What is the cunning time of the recursive Implementation of the shove recurrence? Justify Give memoized recursive algorith for the above problem, Explain how does it improve the running time? oy pro.1143 6 4 (@) Give an algorithm to sort a integers in the range 0 to n? 1 in O(n) time. Justify it’s time complexity ® (©) Suppote we use randomized select to select the sminimum elemeat of the arrey A= <4,2,1, 7,8, 12, 3, 0, 9, S, 10>. Describe a sequence of partitions that resull in a worst case performance of randomized sele. ® () Suppose an input to the bucket sort algorithm is sot uniformly distributed. What willbe the effoet of this condition on the running time of the algorithm? Justify @ (2) A Shopkeeper has n emply boxes and M number of balls Let (KK one Kn} denote the wumber of balls that each box can stor, Given Mand (Ky, Ky Kn}, describe a ‘greedy algorithm whick determines the minimum ‘number of boxes needed 10 store the balls. Give time complexity of the algorithm. o () Design 2 O(¥i"1E) time algorithm 1 find whether 2 given undirected graph is.bipartte (where V is the set of vertices, E ie the set of edges of the sap. ” 1143 1 (6) Give space requirements of adjacency matrix and adjacency ist represestation having m edges snd vertices. e) 6 (a) "Prim’s algorithm only inelude an edge in the “Minimum Spanning tree when i is justfie by the Cut propery." State the Cut Property. Justify the above statement on the given graph showing cute iv all the intermediate steps © () Suppose divide and conquer approach is ured hy fan algorithm to solve a problem on the input of size m. The algorithm divides the problem into f number of smaller instznces, exch of which is Yb the size ofthe original problem. It solves prlem reersivey on these smaller instances and combine theit solutions to construct the final Pro,1143 8 solution ofthe brignal problem. Let Gin) denotes the cost of dividing the problem into smaller instances and Fin) denotes the eost of combining the solutions. Write the recurrence relation to find the running time of the algorithm. Give G(n} and Fn) for Hoth Ouicksort sad Mergesort algorithm, —() (6) Let G be a graph with m vertices and m edges. What is the upper bound on the running time of Depth Firat Search on G, where G is represented as an adjacency matrix? @ [a) A boat fas 9 capaci sms each having ceria weight Wi hit The goal isto select che set of ‘tem thatthe boat should carry so that it could carry maximum load(ie. sum of the weights of selected items should be maximum) within capacity €, © ta carry load. There are si number of sssociated wi Design « Polynomial time Dydumie Programming algorithm for the problem. Derive the time complenty of the above algorithm, Ran this algorithm on the sample iastanee given below to find the optimal solution, 6 1143 9 Capacity of the boat = 4g Hens ‘Weights tem ake Tem 2 ke Them? 1s () Suppose we perform a sequence of » operations tm a data structure in whieh the th operation costs iF Fi am exact power of 2, and 1 otherwise, Use aggregate analysis to determine the amortized cost per operation, o 8.) The following graph represents sework of siports that are connected 10 each other. Each edge epresets the distinee (in multiples of 1000 mies) ‘covered by the igh 0 travel from one aiport to another and vertices represents the airports. A. flight steets from wirport and has to reach Aestinaions c,d and e: Run an efficiet algorithm to Find the route taken by the fligh to exch co is destinations in minimum possible time, Show all the imermodiate steps taken by the algoritha, Also drive its time eompenty o Pro.1143 10 () There are x Jobs where gach job stats at time 5, and finishes at time fi, There isa profit associated ‘with each job. The goal isto find a subset of nos: ‘overlapping jobs such that the sum of their profits Given below is the instance of the problem: cb Namba [Stat Time | Fash tne] Prot w 0 o oer o 6. @ job 1 a 30 obs 3 5 0 ob 5 7 30 obs 5 3 = Dobe 7 3 w ve a Dynamic programing the shove problem, Explain the recurrence relation sed inthe solution, tive solution for Show that the “Optimal solution to the ahove problem contains within it optimal solution 4 its subproblems.” With reference to the above example © (1500)
You might also like
The Subtle Art of Not Giving a F*ck: A Counterintuitive Approach to Living a Good Life
From Everand
The Subtle Art of Not Giving a F*ck: A Counterintuitive Approach to Living a Good Life
Mark Manson
4/5 (6125)
Principles: Life and Work
From Everand
Principles: Life and Work
Ray Dalio
4/5 (627)
The Gifts of Imperfection: Let Go of Who You Think You're Supposed to Be and Embrace Who You Are
From Everand
The Gifts of Imperfection: Let Go of Who You Think You're Supposed to Be and Embrace Who You Are
Brené Brown
4/5 (1148)
Never Split the Difference: Negotiating As If Your Life Depended On It
From Everand
Never Split the Difference: Negotiating As If Your Life Depended On It
Chris Voss
4.5/5 (932)
The Glass Castle: A Memoir
From Everand
The Glass Castle: A Memoir
Jeannette Walls
4/5 (8214)
Grit: The Power of Passion and Perseverance
From Everand
Grit: The Power of Passion and Perseverance
Angela Duckworth
4/5 (631)
Sing, Unburied, Sing: A Novel
From Everand
Sing, Unburied, Sing: A Novel
Jesmyn Ward
4/5 (1253)
The Perks of Being a Wallflower
From Everand
The Perks of Being a Wallflower
Stephen Chbosky
4/5 (8365)
Shoe Dog: A Memoir by the Creator of Nike
From Everand
Shoe Dog: A Memoir by the Creator of Nike
Phil Knight
4.5/5 (860)
Her Body and Other Parties: Stories
From Everand
Her Body and Other Parties: Stories
Carmen Maria Machado
4/5 (877)
Hidden Figures: The American Dream and the Untold Story of the Black Women Mathematicians Who Helped Win the Space Race
From Everand
Hidden Figures: The American Dream and the Untold Story of the Black Women Mathematicians Who Helped Win the Space Race
Margot Lee Shetterly
4/5 (954)
The Hard Thing About Hard Things: Building a Business When There Are No Easy Answers
From Everand
The Hard Thing About Hard Things: Building a Business When There Are No Easy Answers
Ben Horowitz
4.5/5 (361)
Steve Jobs
From Everand
Steve Jobs
Walter Isaacson
4/5 (2922)
Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future
From Everand
Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future
Ashlee Vance
4.5/5 (484)
The Emperor of All Maladies: A Biography of Cancer
From Everand
The Emperor of All Maladies: A Biography of Cancer
Siddhartha Mukherjee
4.5/5 (277)
A Man Called Ove: A Novel
From Everand
A Man Called Ove: A Novel
Fredrik Backman
4.5/5 (4972)
Angela's Ashes: A Memoir
From Everand
Angela's Ashes: A Memoir
Frank McCourt
4.5/5 (444)
Brooklyn: A Novel
From Everand
Brooklyn: A Novel
Colm Tóibín
3.5/5 (2061)
The Art of Racing in the Rain: A Novel
From Everand
The Art of Racing in the Rain: A Novel
Garth Stein
4/5 (4281)
The Yellow House: A Memoir (2019 National Book Award Winner)
From Everand
The Yellow House: A Memoir (2019 National Book Award Winner)
Sarah M. Broom
4/5 (100)
The Little Book of Hygge: Danish Secrets to Happy Living
From Everand
The Little Book of Hygge: Danish Secrets to Happy Living
Meik Wiking
3.5/5 (447)
The World Is Flat 3.0: A Brief History of the Twenty-first Century
From Everand
The World Is Flat 3.0: A Brief History of the Twenty-first Century
Thomas L. Friedman
3.5/5 (2283)
Bad Feminist: Essays
From Everand
Bad Feminist: Essays
Roxane Gay
4/5 (1068)
Yes Please
From Everand
Yes Please
Amy Poehler
4/5 (1987)
Devil in the Grove: Thurgood Marshall, the Groveland Boys, and the Dawn of a New America
From Everand
Devil in the Grove: Thurgood Marshall, the Groveland Boys, and the Dawn of a New America
Gilbert King
4.5/5 (278)
The Outsider: A Novel
From Everand
The Outsider: A Novel
Stephen King
4/5 (1993)
The Woman in Cabin 10
From Everand
The Woman in Cabin 10
Ruth Ware
3.5/5 (2641)
A Tree Grows in Brooklyn
From Everand
A Tree Grows in Brooklyn
Betty Smith
4.5/5 (1936)
The Sympathizer: A Novel (Pulitzer Prize for Fiction)
From Everand
The Sympathizer: A Novel (Pulitzer Prize for Fiction)
Viet Thanh Nguyen
4.5/5 (125)
A Heartbreaking Work Of Staggering Genius: A Memoir Based on a True Story
From Everand
A Heartbreaking Work Of Staggering Genius: A Memoir Based on a True Story
Dave Eggers
3.5/5 (692)
Team of Rivals: The Political Genius of Abraham Lincoln
From Everand
Team of Rivals: The Political Genius of Abraham Lincoln
Doris Kearns Goodwin
4.5/5 (1912)
Wolf Hall: A Novel
From Everand
Wolf Hall: A Novel
Hilary Mantel
4/5 (4074)
On Fire: The (Burning) Case for a Green New Deal
From Everand
On Fire: The (Burning) Case for a Green New Deal
Naomi Klein
4/5 (75)
Fear: Trump in the White House
From Everand
Fear: Trump in the White House
Bob Woodward
3.5/5 (830)
Rise of ISIS: A Threat We Can't Ignore
From Everand
Rise of ISIS: A Threat We Can't Ignore
Jay Sekulow
3.5/5 (143)
Manhattan Beach: A Novel
From Everand
Manhattan Beach: A Novel
Jennifer Egan
3.5/5 (901)
John Adams
From Everand
John Adams
David McCullough
4.5/5 (2530)
The Light Between Oceans: A Novel
From Everand
The Light Between Oceans: A Novel
M L Stedman
4.5/5 (790)
The Unwinding: An Inner History of the New America
From Everand
The Unwinding: An Inner History of the New America
George Packer
4/5 (45)
Little Women
From Everand
Little Women
Louisa May Alcott
4/5 (105)
The Constant Gardener: A Novel
From Everand
The Constant Gardener: A Novel
John le Carré
3.5/5 (109)
Related titles
Click to expand Related Titles
Carousel Previous
Carousel Next
The Subtle Art of Not Giving a F*ck: A Counterintuitive Approach to Living a Good Life
From Everand
The Subtle Art of Not Giving a F*ck: A Counterintuitive Approach to Living a Good Life
Principles: Life and Work
From Everand
Principles: Life and Work
The Gifts of Imperfection: Let Go of Who You Think You're Supposed to Be and Embrace Who You Are
From Everand
The Gifts of Imperfection: Let Go of Who You Think You're Supposed to Be and Embrace Who You Are
Never Split the Difference: Negotiating As If Your Life Depended On It
From Everand
Never Split the Difference: Negotiating As If Your Life Depended On It
The Glass Castle: A Memoir
From Everand
The Glass Castle: A Memoir
Grit: The Power of Passion and Perseverance
From Everand
Grit: The Power of Passion and Perseverance
Sing, Unburied, Sing: A Novel
From Everand
Sing, Unburied, Sing: A Novel
The Perks of Being a Wallflower
From Everand
The Perks of Being a Wallflower
Shoe Dog: A Memoir by the Creator of Nike
From Everand
Shoe Dog: A Memoir by the Creator of Nike
Her Body and Other Parties: Stories
From Everand
Her Body and Other Parties: Stories
Hidden Figures: The American Dream and the Untold Story of the Black Women Mathematicians Who Helped Win the Space Race
From Everand
Hidden Figures: The American Dream and the Untold Story of the Black Women Mathematicians Who Helped Win the Space Race
The Hard Thing About Hard Things: Building a Business When There Are No Easy Answers
From Everand
The Hard Thing About Hard Things: Building a Business When There Are No Easy Answers
Steve Jobs
From Everand
Steve Jobs
Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future
From Everand
Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future
The Emperor of All Maladies: A Biography of Cancer
From Everand
The Emperor of All Maladies: A Biography of Cancer
A Man Called Ove: A Novel
From Everand
A Man Called Ove: A Novel
Angela's Ashes: A Memoir
From Everand
Angela's Ashes: A Memoir
Brooklyn: A Novel
From Everand
Brooklyn: A Novel
The Art of Racing in the Rain: A Novel
From Everand
The Art of Racing in the Rain: A Novel
The Yellow House: A Memoir (2019 National Book Award Winner)
From Everand
The Yellow House: A Memoir (2019 National Book Award Winner)
The Little Book of Hygge: Danish Secrets to Happy Living
From Everand
The Little Book of Hygge: Danish Secrets to Happy Living
The World Is Flat 3.0: A Brief History of the Twenty-first Century
From Everand
The World Is Flat 3.0: A Brief History of the Twenty-first Century
Bad Feminist: Essays
From Everand
Bad Feminist: Essays
Yes Please
From Everand
Yes Please
Devil in the Grove: Thurgood Marshall, the Groveland Boys, and the Dawn of a New America
From Everand
Devil in the Grove: Thurgood Marshall, the Groveland Boys, and the Dawn of a New America
The Outsider: A Novel
From Everand
The Outsider: A Novel
The Woman in Cabin 10
From Everand
The Woman in Cabin 10
A Tree Grows in Brooklyn
From Everand
A Tree Grows in Brooklyn
The Sympathizer: A Novel (Pulitzer Prize for Fiction)
From Everand
The Sympathizer: A Novel (Pulitzer Prize for Fiction)
A Heartbreaking Work Of Staggering Genius: A Memoir Based on a True Story
From Everand
A Heartbreaking Work Of Staggering Genius: A Memoir Based on a True Story
Team of Rivals: The Political Genius of Abraham Lincoln
From Everand
Team of Rivals: The Political Genius of Abraham Lincoln
Wolf Hall: A Novel
From Everand
Wolf Hall: A Novel
On Fire: The (Burning) Case for a Green New Deal
From Everand
On Fire: The (Burning) Case for a Green New Deal
Fear: Trump in the White House
From Everand
Fear: Trump in the White House
Rise of ISIS: A Threat We Can't Ignore
From Everand
Rise of ISIS: A Threat We Can't Ignore
Manhattan Beach: A Novel
From Everand
Manhattan Beach: A Novel
John Adams
From Everand
John Adams
The Light Between Oceans: A Novel
From Everand
The Light Between Oceans: A Novel
The Unwinding: An Inner History of the New America
From Everand
The Unwinding: An Inner History of the New America
Little Women
From Everand
Little Women
The Constant Gardener: A Novel
From Everand
The Constant Gardener: A Novel