HashSet
Introduction
Majorly used for tradeoff between Space and time complexities, since it offers exceptional time complexity for a considerable amount of space (CAN USE A TON OF SPACE AT TIMES). High tradeoff between time and space.
Time Complexity
Insertion: O(1)
Search: O(1)
Deletion: O(1)
But how?
Realistically and practically, applications don't use data with ( ) (without this assumption the time/space complexities of many data structures would change) [ Quora Answer ]
HashSets are implemented by using hashing functions (refer Hashing) to convert data to integer form. Comparison between integers is, natively, O(1).
Last updated