subject

Design a recursive algorithm called Extrema(A, p,r) that, given an array A[1...n] finds and returns both the min and max of the subarray Aſp...r] as an ordered pair: (min(Ap...r]), max(Aſp...r])). Your algorithm should perform exactly [3n/2] – 2 array comparisons on an input array of length n. (Hint: Section 9.1 of the text describes an iterative algorithm that does this.) a. Write your algorithm in pseudo-code. b. Prove the correctness of your algorithm by induction on m = r - p + 1, the length of the subarray Aſp - r]. c. Write a recurrence for the number of comparisons performed on A[1...n], and show that T(n) = [3n/2] – 2 is its solution.

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 20:00, darlene93
An excel which cell contains =b2 is copied to row below, the same column. what will be the new cell's content
Answers: 2
image
Computers and Technology, 23.06.2019 16:50, lukeakalucas
15: 28read the summary of "an indian's view of indian affairs."15 betterin "an indian's view of indian affairs," it is asserted that conflicts could be reduced if white americansunderstood native americans..pswhich of the following would make this summary more complete? eleo the fact that chief joseph believes the great spirit sees everythinthe fact that chief joseph was born in oregon and is thirty-eight years oldo the fact that chief joseph states that he speaks from the hearthehehethe fact that chief joseph of the nez percé tribe made this claimebell- ==feetle===-felsefe ==submitmark this and retum.=
Answers: 3
image
Computers and Technology, 24.06.2019 02:10, trint5952
Aspeed limit sign that says "night" indicates the legal speed between sunset and sunrise.
Answers: 2
image
Computers and Technology, 24.06.2019 14:00, ratpizza
Which describes careers that have similar education requirements but different qualifications? product safety engineers and materials engineers industrial safety engineers and industrial health engineers quality control systems managers and inspectors industrial safety and health engineers and hand packers
Answers: 3
You know the right answer?
Design a recursive algorithm called Extrema(A, p,r) that, given an array A[1...n] finds and returns...

Questions in other subjects:

Konu
History, 18.09.2020 14:01
Konu
Mathematics, 18.09.2020 14:01
Konu
Mathematics, 18.09.2020 14:01
Konu
Mathematics, 18.09.2020 14:01
Konu
English, 18.09.2020 14:01
Konu
Mathematics, 18.09.2020 14:01
Konu
Mathematics, 18.09.2020 14:01
Konu
Mathematics, 18.09.2020 14:01
Konu
Mathematics, 18.09.2020 14:01
Konu
English, 18.09.2020 14:01