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 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
a Algorithm EVENDIVA0 n1 for i 0 to n1 do if Ai is even then Ai Ai 2 re... View full answer
Get step-by-step solutions from verified subject matter experts
