hanoisort fully functional