common data structure and algorithm implementation