data structure and some implementation of simple algorithm