• Nie Znaleziono Wyników

CIS 435 Homework 2 (Due: March 11, 2003) Solve ALL the problems. Collaboration is prohibited 8 points total Problem 1.

N/A
N/A
Protected

Academic year: 2021

Share "CIS 435 Homework 2 (Due: March 11, 2003) Solve ALL the problems. Collaboration is prohibited 8 points total Problem 1."

Copied!
1
0
0

Pełen tekst

(1)

CIS 435 Homework 2 (Due: March 11, 2003) Solve ALL the problems. Collaboration is prohibited

8 points total

Problem 1. (2 points)

Solve Problem 7-3 (analysis of Stooge-Sort) from the textbook (page 161).

Problem 2. (2 points)

Solve Exercise 9-3.8 (O(log n) time computation of the median in a special case) from the textbook (page 193). Write the related algorithm in the pseudocode (informal programming language used in the textbook).

Hint:

Look at the relation between ”middle elements”.

Problem 3. (2 points) Assume we have the array

A = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21].

How will this array look after performing Build-Max-Heap(A) using the description of the function Build-Max-Heap(A) from the textbook.

Problem 4. (2 points) Assume we have the array

A = [1, 2, 12, 13, 3, 4, 14, 15, 5, 6, 16, 17, 7, 8, 18, 19, 9, 20, 10, 21, 11]

How will this array look after performing PARTITION(A, 1, 21), where PARTITION is the function from the textbook related to Quicksort (page 146). Assume the first position of A is 1.

Cytaty

Powiązane dokumenty

You should also analyse the sign of the function.. In the end we get the

Justify

June 6, 2006, Math 110.3, Instructor: Pawel Gladki, Time:180 minutes..

Stack-losses of ammonia Y were measured in course of 21 days of operation of a plant for the oxidation of ammonia (NH3) to nitric acid (HNO 3 ).. Discuss the

that the next two focus numbers lie in this ideal.) In such a case one could apply the method of Fran¸coise and Yomdin [3] which allows showing that there are no more than 5

[9] Therefore in tackling the issue of the local livelihood, it is crucial to consider the elements that are essential to its continuity; [a] its great access to the

Co się tyczy szczególnie petryfikacji, ta bardzo jest różna, znajdują się czasem zupełnie jeszcze nieodmienione ciała te wykopane, tak dalece że jeszcze naturalny swój glanc

W muzeum kieleckim znajduje się również inny portret przedstawiciela rodu Jaxa- Bąkowskich, Józefa - podkomorzego chełmskiego (zm. 1777), wykonany przez nie­ znanego m