Can anyone help with with the time complexity of this algorithm, and why it is O(n^2). A step by step explanation would be helpful, thanks!
function divide(x,y)
Input: Two n-bit integers x and y, where y >= 1
Output: The quotient and remainder of x divided by y
if x = 0:
return (q,r) = (0,0)
(q,r) = divide(x/2, y)
q = 2q
r = 2r
if x is odd:
r = r + 1
if r >= y:
r = r - y
q = q + 1
return (q,r)