I was asked to implement integer division with logarithmic time complexity using only bit shifts, additions and subtractions.
I can see how I can deal with a divisor which is a power of 2, but how can I deal with an odd divisor, such that the time remains logarithmic?
Is it even possible?
EDIT: a way to do it in a time complexity that isn't logarithmic but still better than linear will also be welcomed.
Thanks