Question: Show that this multiply algorithm takes O(n^2) operations. Mult(x, y) If (y = 1) return x Else if (y is even) return mult(x, (y/2)) *
Show that this multiply algorithm takes O(n^2) operations.
Mult(x, y)
If (y = 1)
return x
Else if (y is even)
return mult(x, (y/2)) * 2
Else (y is odd)
return mult(x, ((y-1)/2)) * 2 + x
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
