Hacker News new | past | comments | ask | show | jobs | submit login

I always thought the Russian peasants algorithm was faster than this at O(log n). Can someone explain what I've misunderstood?



Conventionally n is the length of the input, which is generally logarithmic in the numerical value of the input for algorithms dealing in integers.

Moreover, analyzing Russian peasant multiplication as O(log N) implies treating addition as constant-time, which it certainly isn't. (This is intuitively clear if we try applying the algorithm with slightly large integers!)




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: