• Tidak ada hasil yang ditemukan

Removing root from a Heap. h.) Enqueue in a Heap-based-Priority-Queue. i.)

N/A
N/A
Protected

Academic year: 2023

Membagikan "Removing root from a Heap. h.) Enqueue in a Heap-based-Priority-Queue. i.)"

Copied!
1
0
0

Teks penuh

(1)

CSC 306 Midterm; Spring 2012.

Q1.

What are the asymptotic complexities of solving the following problems efficiently, give your answer in terms of Θ, Ω or O notation:

a.) Finding Min in an unsorted array.

b.) Finding a Key in a sorted array.

c.) Finding Max in a sorted array.

d.) Merging two sorted array into a larger sorted array.

e.) Pivoting in an unsorted array.

f.) Sorting an array using Radix sort. Explain. (2 pts) g.) Removing root from a Heap.

h.) Enqueue in a Heap-based-Priority-Queue.

i.) Sorting using Randomized Quicksort. Explain.

Q2.

What are the positions (in terms of index number) of (a-e):

(a-e carries 1 point, f carries 5 points) a.) Root in a heap.

b.) First leaf in a Heap.

c.) Last leaf in a Heap.

d.) Left child of node indexed at i in a Heap.

e.) Parent of Right Child indexed at i, in a Heap.

f.) What is minimum and maximum number of nodes in a Heap of height h.

Q3.

I have 6 identical balls in their appearance. 5 of them are exactly of same weight, sixth one (faulty) is different but I don’t know whether it is heavier or lighter. What is the minimum number of comparisons required to locate the faulty ball and tell whether it is light or heavy using a two pan scale (Daripalla). Give an algorithm for your answer.

How many comparisons would be required had I known from the beginning that the faulty ball is heavier? Explain.

Q4.

Argue that the tallest and the second tallest student in a class of 32 can be found in no more that 35 comparisons.

Referensi

Dokumen terkait

information relating to: a description of the area of your research; an account of what you did, why you did it, and what the outcomes were; the relationship of your work to

Из оценок 4.6 для F KS вытекает, что правая часть уравнения 4.3 в норме по ξ равномерно ограничена, но тогда ограничена равномерно по ξ ∈0,∞и сама Sξ.. Поэтому равностепенно непре-