Question: (a) Design brute force algorithm that searches for even number in the list. If even number is found, the algorithm divides it by 2.

(a) Design brute force algorithm that searches for even number in the list. If even number is found, the

(a) Design brute force algorithm that searches for even number in the list. If even number is found, the algorithm divides it by 2. [0.5 mark] ALGORITHM EVENDIV(A[0,..., n-1]) // Search for even number in the list and divide it by two //Input: //Output: (b) What are the basic operations? [0.5 mark] (c) How many times basic operation is executed? [0.5 mark] (d) What is the efficiency class of this algorithm? [0.5 mark]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

a Algorithm EVENDIVA0 n1 for i 0 to n1 do if Ai is even then Ai Ai 2 re... 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

Students Have Also Explored These Related Programming Questions!