the data struct and algorithm