Question: Consider the following function and then answer the question 19 and 20. ALGORITHM q19p (A [1...r]) BEGIN p=A[1]; i=1;j=r+1 repeat repeat i=i+1 until A[i]>=p

Consider the following function and then answer the question 19 and 20.

ALGORITHM q19p (A [1...r]) BEGIN p=A[1]; i=1;j=r+1 repeat repeat i=i+1 until A[i]>=p

repeat j-j-1 until A[j] =j swap (A[i], A[j]) swap (A[1],A[j]) return j

Consider the following function and then answer the question 19 and 20. ALGORITHM q19p (A [1...r]) BEGIN p=A[1]; i=1;j=r+1 repeat repeat i=i+1 until A[i]>=p repeat j-j-1 until A[j] =j swap (A[i], A[j]) swap (A[1],A[j]) return j END. ALGORITHM q19 (A [1...r]) BEGIN swap (A[1],A[r]) s=q19p (A[1...r]) END. 19.Initially, let A-[9.2.6.1.4.3.5.8]. What is a value of A after the function q19(A[O...len(A)-1]) is executed? * 20.Initially, let A-[9.2.6.1.4.3.5.8]. What is a value of s after the function q19(A[O...len(A)-1]) is executed? *

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Q19 The function q19pA1r is a partition function that selec... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Document Format (2 attachments)

PDF file Icon

663d9e8dca081_964347.pdf

180 KBs PDF File

Word file Icon

663d9e8dca081_964347.docx

120 KBs Word File

Students Have Also Explored These Related Programming Questions!