updated algorithms to include 7h from CS106A