5.6 Compute x/y
The book mentions at the end of the solution that: “Therefore, assuming individual shift and add operations take O(1) time, the time complexity is O(n).”
I have trouble understanding the solution as being O(n). There is a while loop that is nested in a while loop in the solution. Wouldn’t that still make the solution O(n^2) regardless of the time it takes for individual shift and add operations?
I might be missing something here. Your clarification would be much appreciated
-H