algorithm debug