OLYMPIADS IN INFORMATICS, 2016, Vol. 10, pp. 19 - 37
© IOI, Vilnius University

ISSN 1822-7732

DOI: 10.15388/ioi.2016.02

Wavelet Trees for Competitive Programming

Robinson CASTRO1, Nico LEHMANN1, Jorge PÉREZ1,2, Bernardo SUBERCASEAUX1

1Department of Computer Science, Universidad de Chile Beauchef 851, Santiago, Chile
2 Chilean Center for Semantic Web Research email: {rocastro, nlehmann, jperez, bsuberca}@dcc.uchile.cl


The wavelet tree is a data structure to succinctly represent sequences of elements over a fixed but potentially large alphabet. It is a very versatile data structure which exhibits interesting properties even when its compression capabilities are not considered, efficiently supporting several queries. Although the wavelet tree was proposed more than a decade ago, it has not yet been widely used by the competitive programming community. This paper tries to fill the gap by showing how this data structure can be used in classical competitive programming problems, discussing some implementation details, and presenting a performance analysis focused in a competitive programming setting.


wavelet tree, data structures, competitive programming, quantile query, range query.

PDFTo preview full article text in PDF format click here

Get Free ReaderYou could obtain free Acrobat Reader from Adobe

Copyright © International Olympiads in Informatics, Vilnius University Institute of Mathematics and Informatics, 2016