d. What are the sizes of each of the sub-problems tackled in the conquer phase? e. Name the line number(s) where the combine is taking place. f. Is this algorithm in-place? If yes, justify your answer. If no, determine the amount of extra space needed per recursive call. g. Write down the recurrence associated with the run-time complexity of the given algorithm.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Please answer d,e,f,g
a. Name the line number(s) where the base case takes place.
b. Name the line number(s) where the divide phase is taking place.
c. Name the line numer(s) where the conquer phase is taking place.
d. What are the sizes of each of the sub-problems tackled in the conquer phase?
e. Name the line number(s) where the combine is taking place.
f. Is this algorithm in-place? If yes, justify your answer. If no, determine the amount of extra space needed per recursive call.
g. Write down the recurrence associated with the run-time complexity of the given algorithm.
Transcribed Image Text:a. Name the line number(s) where the base case takes place. b. Name the line number(s) where the divide phase is taking place. c. Name the line numer(s) where the conquer phase is taking place. d. What are the sizes of each of the sub-problems tackled in the conquer phase? e. Name the line number(s) where the combine is taking place. f. Is this algorithm in-place? If yes, justify your answer. If no, determine the amount of extra space needed per recursive call. g. Write down the recurrence associated with the run-time complexity of the given algorithm.
You are given the following divide and conquer algorithm whose output you are not required to determine. Treat k here as a parameter that is in 0(1).
line 0: DC(A[a_p,...,a_r], k)
line 1: n <-- length(A)
line 2: if n == k
line 3:
return A[p..p+k-1]
line 4: else // Define two arrays/sequences A1 and A2 each of length n/2
line 5:
for i = 1 to n/2
Line 6:
do A1[i] <-- A[i]
Line 7:
A2[i] <-- A[n/2 + 1]
line 8:
for i = 1 to n/2
line 9:
do for j = i+1 to n/2
line 10:
do if A1[i] == A2[j]
line 11:
then A2[j] <-- 0
line 12:
b1<- DC(A1[1,...n/2], k)
line 13:
b2 <-- DC(A2[1,..,n/2], k)
line 14:
return max(b1,b2)
a. Name the line number(s) where the base case takes place.
Activate Windows
b. Name the line number(s) where the divide phase is taking place.
Go to Settings to activate
Transcribed Image Text:You are given the following divide and conquer algorithm whose output you are not required to determine. Treat k here as a parameter that is in 0(1). line 0: DC(A[a_p,...,a_r], k) line 1: n <-- length(A) line 2: if n == k line 3: return A[p..p+k-1] line 4: else // Define two arrays/sequences A1 and A2 each of length n/2 line 5: for i = 1 to n/2 Line 6: do A1[i] <-- A[i] Line 7: A2[i] <-- A[n/2 + 1] line 8: for i = 1 to n/2 line 9: do for j = i+1 to n/2 line 10: do if A1[i] == A2[j] line 11: then A2[j] <-- 0 line 12: b1<- DC(A1[1,...n/2], k) line 13: b2 <-- DC(A2[1,..,n/2], k) line 14: return max(b1,b2) a. Name the line number(s) where the base case takes place. Activate Windows b. Name the line number(s) where the divide phase is taking place. Go to Settings to activate
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Binary numbers
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education