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

![ALGORITHM q19p (A [1...r]) BEGIN p=A[1]; i=1;j=r+1 repeat repeat i=i+1 until A[i]>=p](https://dsd5zvtm8ll6.cloudfront.net/questions/2024/05/6639c3047d31f_1715054107527.jpg)
![repeat j-j-1 until A[j] =j swap (A[i], A[j]) swap (A[1],A[j]) return j](https://dsd5zvtm8ll6.cloudfront.net/questions/2024/05/6639c31748af8_1715054126282.jpg)
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
Q19 The function q19pA1r is a partition function that selec... View full answer
Get step-by-step solutions from verified subject matter experts
Document Format (2 attachments)
663d9e8dca081_964347.pdf
180 KBs PDF File
663d9e8dca081_964347.docx
120 KBs Word File
