Hey Codeforces community,

have you ever seen any problems that use Wavelet Tree/Matrix or can be solved using these data structures?

Problems created especially for these structures don't count (for example they should appear in some competition).

# | User | Rating |
---|---|---|

1 | tourist | 3947 |

2 | ecnerwala | 3654 |

3 | jiangly | 3627 |

4 | jqdai0815 | 3620 |

5 | orzdevinwang | 3612 |

6 | Benq | 3586 |

7 | Radewoosh | 3582 |

8 | Geothermal | 3569 |

8 | cnnfls_csy | 3569 |

10 | ksun48 | 3474 |

# | User | Contrib. |
---|---|---|

1 | awoo | 163 |

2 | maomao90 | 160 |

3 | adamant | 156 |

4 | atcoder_official | 155 |

5 | maroonrk | 153 |

6 | -is-this-fft- | 148 |

6 | SecondThread | 148 |

8 | Petr | 147 |

9 | nor | 145 |

10 | cry | 144 |

Hey Codeforces community,

have you ever seen any problems that use Wavelet Tree/Matrix or can be solved using these data structures?

Problems created especially for these structures don't count (for example they should appear in some competition).

↑

↓

Codeforces (c) Copyright 2010-2024 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Aug/06/2024 01:51:50 (g1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|

This Codeforces Div1-D problem. Solution using wavelet tree is described in this comment.

Min_25 solved this Codechef problem in $$$O(N\log^2 N)$$$ with 3D Wavelet Matrix. I'm not sure if that's the easiest way to achieve $$$O(N\log^2 N)$$$ though.

Nevermind, it seems persistent trees also do the job :)

Wavelet Trees Tutorial it's turorial for wavelet trees and in comments there are some problems

In the paper Wavelet Trees for Competitive Programming by Robinson Castro, Nico Lehmann, Jorge Perez and Bernardo Subercaseaux, three problems where wavelet trees are useful are introduced. These problems can also be solved with persistent segment trees, but wavelet trees have much lower memory usage.

In general I think that all problems solvable with wavelet trees can also be solved with persistent or 2D segment trees. However the advantage of wavelet trees is lower memory usage. The reason why wavelet trees were invented in the first place was to create memory optimized data structures in bioinformatics, where strings like the human DNA are billions of characters long.

UTPC 2011 L (in Japanese) You are given a tree. Each node $$$v$$$ has a number $$$a_v$$$. For each query, you have to output the $$$L_q$$$th smallest number on the path from $$$v_q$$$ to $$$w_q$$$. $$$N,Q \leq 1e5, a_v \leq 1e9$$$.

#302 (Div 1) Problem E can be solved using Wavelet Matrix.