The following algorithm takes as input two length-n positive integers a, b. Analyse the asymp- totic behaviour of this a
Posted: Wed Mar 30, 2022 9:27 am
The following algorithm takes as input two length-n positive integers a, b. Analyse the asymp- totic behaviour of this algorithm, treating all assignment operation, comparisons, control flow, and arithmetic operations as elementary. Note that mod refers to the modulo operation, i.e., a mod b outputs the remainder of a = b. Express the best-case and the worst-case running time of the algorithm using O-notation, with respect to the input length n. function ALGO(a,b) Require: Integers a,b if a<b then cab be a ае с end if while b +0 do ct a mod b arb bec end while return a end function