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.*

### Tutorials:

**Sqrt Decomposition****Introduction to Mo's algorithm**— By anudeep2011**Introduction to Mo's algorithm**(Video tutorial) — By kazama460**MO's algorithm on Tree**— By animeshf

### Basic problems:

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

- Queries for elements having values within the range A to B
- Queries for Count of divisors of the product of an Array in given range
- Number of elements less than or equal to a number in a subarray
- Count of odd and even parity elements in subarray using Mo’s algorithm

### List of problems:

- DQUERY — SPOJ
- Count on a tree II — SPOJ
- Zero Query — SPOJ
- Powerful array — Codeforces
- Tree and Queries — Codeforces
- Jeff and Removing Periods — Codeforces
- XOR and Favorite Number
- Factor Tree — Codechef
- So Close Yet So Far — Codechef
- Chef and Graph Queries — Codechef
- Tree difference — Codechef
- Sherlock and Inversions — Codechef
- Estimating progress — Codechef
- Anup at Amrithapuri — Codechef
- Chefina and Beautiful Pairs — Codechef
- Traffic Count — Codechef
- Chef and cities — Codechef
- Kriti and her Birthday Gift — Hackerearth
- Sherlock and Inversions — Hackerearth

**Edit:**

Thanks for the upvotes! It means a lot to me