- The Following Algorithm Takes As Input Two Length N Positive Integers A B Analyse The Asymp Totic Behaviour Of This A 1 (82.93 KiB) Viewed 32 times
The following algorithm takes as input two length-n positive integers a, b. Analyse the asymp- totic behaviour of this a
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
The following algorithm takes as input two length-n positive integers a, b. Analyse the asymp- totic behaviour of this a
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