Algorithm andDdata structure