Question: Write The Recurrence Relation And The Initial Condition For The Running Time In The Average Case For The Pseudo-Code Algorithm PINKY Defined Below. Count Only

Write The Recurrence Relation And The Initial Condition For The Running Time In The Average Case For The Pseudo-Code Algorithm PINKY Defined Below. Count Only Comparisons. Function PINKY (List A[0..1 – 1] Of Integer Numbers) Value-Even=False Value-Odd+False If N > 1 Then For It To N - 1 Do If A[I]%2 = 0 And Value-Even=False Then 2 Comparisons Value-Even

18. Write the recurrence relation and the initial condition for the running

 

 

18. Write the recurrence relation and the initial condition for the running time in the average case for the pseudo-code algorithm PINKY defined below. Count only comparisons. function PINKY (list a[0..n-1] of integer numbers) value-even-false value-odd-false If n > 1 then for i0 ton - 1 do If a[i]%2 0 and value-even-false then 2 comparisons value-even true for i0 ton - 1 do If a[i]%7 3 and value-odd-false then 3 comparisons value-odd true PINKY(a[0..n-3]) return value-even, value-odd Explain your answer. [6 marks]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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

Students Have Also Explored These Related Accounting Questions!