Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Advanced Algorithms Practice Midterm - West Virginia University - Prof. Krishnamurthy Subr, Exams of Discrete Mathematics

The practice midterm for the advanced analysis of algorithms course at west virginia university. The midterm includes five problems covering topics such as array manipulation, recurrence relations, heaps, range queries, and knapsack problems. Students are encouraged to attempt as many problems as they can in class, as the midterm will not be graded. Solutions can be found online.

Typology: Exams

Pre 2010

Uploaded on 07/30/2009

koofers-user-2wd-1
koofers-user-2wd-1 🇺🇸

10 documents

1 / 1

Toggle sidebar

Related documents


Partial preview of the text

Download Advanced Algorithms Practice Midterm - West Virginia University - Prof. Krishnamurthy Subr and more Exams Discrete Mathematics in PDF only on Docsity! Advanced Analysis of Algorithms - Practice Midterm L. Kovalchick LCSEE, West Virginia University, Morgantown, WV {lynn@csee.wvu.edu} Please attempt as many problems as you can in class. The practice midterm will not be graded, i.e. there are no points. The solutions are posted at: http://www.csee.wvu.edu/˜ksmani/courses/fa03/algos/algos.html 1 Problems 1. Show that n ∑ i=1 i3 = [ n · (n + 1) 2 ]2. 2. Consider the recurrence relation: T (n) = 1, if n = 1 = T (n− 1) + 2n, otherwise Show that T (n) = 2n+1 − 3. 3. Give an algorithm which will return the third largest element of a heap with heap− size ≥ 3, in O(1) time. Assume that all elements are unique. 4. Describe an algorithm that, given n integers in the range from 1 to k, preprocesses its input and then answers any query about how many of the n integers fall into a range from [a · · · b] in O(1) time. Your algorithm should use O(n + k) preprocessing time. 5. Suppose a biker is about to go on a ride on a bike trail carrying a single knapsack. Suppose further that she knows the maximum total weight W that she can carry, and she has a set S of n different useful items that she can potentially take with her. Let us assume that each item j has an integer weight wj and a benefit value bj , which is a value that the biker assigns to item j. Her problem is to optimize the value of the items that she places into her knapsack, without going over the weight limit W (i.e., maximize ∑ j∈T bj subject to ∑ j∈T wj ≤W ). Give a recursive definition for the profit value of the optimal solution to this problem. 1
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved