set to unordered_set in efficient algorithm