Given it should be of O(log(n)). On Tue, May 3, 2011 at 12:48 PM, abhishekriyer <abhishekr.iye...@gmail.com>wrote:
> 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 <dave_and_da...@juno.com> 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 algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > > -- P.S.Raghu Chandra, IIIT Allahabad, B.Tech 8th sem. ps.raghuchan...@gmail.com -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.