What kind of algorithm is this? please explain