Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

 

 

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Managerial Accounting

Authors: Ray H. Garrison, Eric W. Noreen, Peter C. Brewer

13th Edition

978-0073379616, 73379611, 978-0697789938

More Books

Students also viewed these Accounting questions

Question

CMIN 2 1 1 Final exam project

Answered: 1 week ago