Question1 (b)Consider the followingalgorithmwhere Small is an array of ninteger values: AlgorithmQ1 //Input: An array Smallcontaining ninteger values b = ∞ for h = 1 to n-1 for k = h + 1 to n if...



Question1 (b)Consider the followingalgorithmwhere Small is an array of ninteger values:


AlgorithmQ1

//Input: An array Smallcontaining ninteger values

b = ∞

for h = 1 to n-1

      for k = h + 1 to n

          if (Small[h] –Small[k]) <>

                      b = Small[h] –Small[k]

                          return b


i.Explain what does this algorithm compute.

ii.Findthe asymptotic bound/complexity ofthis algorithm.

iii.Producean improved algorithm to Question1 (b) above with a better asymptotic complexity/running time.

iv.Findthe asymptotic bound/complexity of the improvedalgorithmin Question 1(b)iii. above.








Jun 09, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here