completed sort algo