What are the Big-O notations for Sets in Javascript? Is it always faster than an array? Additionally, can you tell me where I should be looking here for sets? (i.e. what category does it fall under... is it hash table?)
            Asked
            
        
        
            Active
            
        
            Viewed 2,260 times
        
    1 Answers
0
            
            
        add, delete and has is at least O(log n) or even O(1)
forEach, entries, values, keys traversal is O(n)
Is it always faster than an array?
No, traversal is roughly at the same speed.
 
    
    
        Jonas Wilms
        
- 132,000
- 20
- 149
- 151
