Algorithm and data structure