look at set (Hashset, enumset) and hash (HashMap,linkedhash…,idnetityhash..) based implementations. they have O(1) for contains()
This cheatsheet is of great help.
look at set (Hashset, enumset) and hash (HashMap,linkedhash…,idnetityhash..) based implementations. they have O(1) for contains()
This cheatsheet is of great help.