Back to course home
0% completed
Vote For New Content
Space Complexity of Hashset
Wang Jian Ann Howard
Jul 27, 2023
Hi there, I would like to check why is the space complexity of HashSet is O(1) instead of O(n)? TIA!
0
0
Comments
Comments
Design Gurus2 years ago
Since the HashSet can store all English letters at max, the space complexity will be O(26), which is asymptotically equal to O(1).
A HashSet in many programming languages (such as Java or Python) is a data structure that stores unique elements in an unordered way. It u...
On this page
Problem Statement
Solution
Code
Time Complexity
Space Complexity
Conclusion