Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Given an element with index i in the array - representation of a heap, which of the following correctly computes the index of the left

Given an element with index i in the array-representation of a heap, which of the following correctly computes the index of the left child of that element?
a.i+12
b.2**i
c.(i+1)%2
d.2**i+1
e.2**i+2
What is the running-time (as a tight big-O bound) of restoring the heap-order of a heap after a deleteMax operation?
a.O(1)
b.O(logN)
c.O(N)
d.O(NlogN)
e.O(N2)
For the interval scheduling problem, which greedy paradigm produces an optimal solution?
a. the shortest jobs
b. the job with the fewest conflicts
c. the job with the earliest starting time
d. the job with the earliest ending time
e. none of the above
What is the best-case running time (as a tight big-O bound) for quicksort to sort an array of n elements?
a.O(logn)
b.O(n)
c.O(nlogn)
d.O(n2)
e.O(n2logn)
Merge Sort makes two recursive calls. Which statement is true after these recursive calls finish, but before the merge step?
a. The array elements form a heap.
b. Elements in each half of the array are sorted amongst themselves.
c. Elements in the first half of the array are less than or equal to elements in the second half of the array.
d. Both (a) and (b) are true.
d. None of the above.
Suppose you have coins of denominations 1,3 and 4. You use a greedy algorithm, in which you choose the largest denomination coin which is not greater than the remaining sum. For which of the following sums, will the algorithm NOT produce an optimal answer?
a.20
b.12
c.6
d.5
e.7
Median of three quick sort is an in-place sort.
ALWAYS
SOMETIMES
NEVER
For the fractional knapsack problem, being greedy on the item with the smallest weight yields an optimal solution.
ALWAYS
SOMETIMES
NEVER
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

9th Edition

B01JXPZ7AK, 9780805360479

More Books

Students also viewed these Databases questions