Questiastiriestttidtieess) Find the comhe ing of the following blocks of code or algorithm's description. [Note: your answer must show the steps that lead to your final answer] (2 marks each) 1) count...


Questiastiriestttidtieess)<br>Find the comhe ing of the following blocks of code or algorithm's description.<br>[Note: your answer must show the steps that lead to your final answer]<br>(2 marks each)<br>1)<br>count = 1 for i = 1<br>2)<br>count = 0 for i<br>= 1 to n do<br>for k = 1 to n do<br>for (j = 2;j<n;j*= 2)<br>to 100 do<br>count += i<br>end for for k = 1<br>to 100 do<br>count = i +k +j;<br>count *= k end for<br>while j< n do<br>count +=j<br>j*= 2;<br>end for<br>end<br>for<br>end for<br>end while<br>3)<br>4)<br>The algorithm solves the problem<br>of size n by dividing it into 8<br>subproblems of size n/2,<br>recursively solving each sub-<br>problem, and then combining the<br>solutions in<br>5)<br>The algorithm solves the problem<br>by breaking it into 4 sub-problems<br>of 1/2 the scale, recursively<br>solving each sub-maze, and then<br>combining the solutions in linear<br>time<br>O(n³) time<br>The algorithm solves the problem<br>of size n by recursively solving<br>two sub-problems of size n- 1,<br>and then combining the solutions<br>in constant time.<br>

Extracted text: Questiastiriestttidtieess) Find the comhe ing of the following blocks of code or algorithm's description. [Note: your answer must show the steps that lead to your final answer] (2 marks each) 1) count = 1 for i = 1 2) count = 0 for i = 1 to n do for k = 1 to n do for (j = 2;j< n="" do="" count="" +="j" j*="2;" end="" for="" end="" for="" end="" for="" end="" while="" 3)="" 4)="" the="" algorithm="" solves="" the="" problem="" of="" size="" n="" by="" dividing="" it="" into="" 8="" subproblems="" of="" size="" n/2,="" recursively="" solving="" each="" sub-="" problem,="" and="" then="" combining="" the="" solutions="" in="" 5)="" the="" algorithm="" solves="" the="" problem="" by="" breaking="" it="" into="" 4="" sub-problems="" of="" 1/2="" the="" scale,="" recursively="" solving="" each="" sub-maze,="" and="" then="" combining="" the="" solutions="" in="" linear="" time="" o(n³)="" time="" the="" algorithm="" solves="" the="" problem="" of="" size="" n="" by="" recursively="" solving="" two="" sub-problems="" of="" size="" n-="" 1,="" and="" then="" combining="" the="" solutions="" in="" constant="">

Jun 05, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here