algorithm&data structure exercise