A naive method would be repeated subtraction which is division. So subtract the number repeatedly by 5 unless the value that remains is less than 0. If its 0 then the number is divisible by 5
On May 3, 9:25 am, Dave <[email protected]> wrote: > Given an integer n, give an O(log n) algorithm to determine if n is > divisible by 5 without using division or mod. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
