revised space complexity