This can be solved by only storing the last front (column/wavefront), since each front only depends on the one before it. After completing the previous step, we can simply drop the hashmap for front \(f\), since it will not be needed anymore. If we only store hashmaps for the last front, we ‘forget’ \(g\) for states in previous fronts.