added notes about the algorithm's space complexity