O(1) doesn’t mean instant. O(1) means constant without regard to the size of the data. The hash function takes a certain amount of time, but that amount of time doesn’t scale with the size of the collection.
O(1) doesn’t mean instant. O(1) means constant without regard to the size of the data. The hash function takes a certain amount of time, but that amount of time doesn’t scale with the size of the collection.