saurabhyadavz's blog

By saurabhyadavz, 4 years ago, In English

Possibly, someone called "MO" once used the trick in a local contest, and the name stuck and later got popular. I have never encountered the name "Mo's algorithm" outside of competitive programming.

The technique, or the term "Mo's Algorithm" ("莫隊算法" in Chinese) was originally thought of and popularized by 莫涛 (Mo Tao) and his teammates. It was first used to tackle a problem from 2009 China IOI Camp: 小Z的袜子(hose) — authored by 莫涛 himself. The problem was: given a sequence of integers, for any given interval, calculate the probability of choosing any 2 numbers and the 2 numbers are equal.

Now let's start. I have here compiled the tutorial, some articles written by me, and problems on Mo's algorithm.


Basic problems:

I have written some basic articles on Mo's algorithm which has been published on Geeksforgeeks.

List of problems:


Thanks for the upvotes! It means a lot to me

Full text and comments »

  • Vote: I like it
  • +243
  • Vote: I do not like it