updated implementations of all algorithms, now using sparse data structures (unordered_map)