UnorderedSet Visualizer

Set with separate chaining - no duplicates, no ordering

6
Buckets
0
Elements
0
Avg Chain Length
0.0%
Load Factor

Current Set Contents

Set is empty

Ready for UnorderedSet operations

0 unique values

Hash Function with Separate Chaining

hash(value) = (Σ value[i] × 31) % 6
Collisions resolved by chaining - duplicates automatically prevented

Hash Table Structure with Separate Chaining

[0]
0 items
Empty bucket
[1]
0 items
Empty bucket
[2]
0 items
Empty bucket
[3]
0 items
Empty bucket
[4]
0 items
Empty bucket
[5]
0 items
Empty bucket

Chain Length Distribution

B0
B1
B2
B3
B4
B5
Height represents chain length in each bucket
ℹ️
Set Properties
• No duplicate values allowed - duplicate insertions are automatically ignored
• Unordered collection - elements have no specific order
• Fast operations - average O(1) time for insert, find, and erase

UnorderedSet Operations:

Basic Operations:

  • insert(value): Add value to set (ignores duplicates)
  • find(value): Check if value exists in set
  • erase(value): Remove value from set
  • size(): Get number of elements in set
  • empty(): Check if set is empty

Set Operations:

  • Union: Combine elements from multiple sets
  • Intersection: Find common elements

Characteristics:

  • No Duplicates: Each element appears at most once
  • Unordered: No specific ordering of elements
  • Average Time: O(1) for insert, find, erase
  • Worst Case: O(n) when all elements hash to same bucket
  • Space: O(n) for elements + O(b) for buckets
  • Use Cases: Membership testing, removing duplicates, set operations
C++ STL Context: unordered_set is the hash table implementation of a set, while std::set uses a balanced binary search tree (red-black tree). Use unordered_set when you need fast average-case performance and dont need ordered iteration.