Set ADT Visualization

Two sets A and B with membership ops + set-algebra (Union, Intersect, Difference, Symmetric)

Element Operations

Target:

Set Algebra (result goes into R)

Sets

Set A|A| = 0
Set B|B| = 0
Result Set R|R| = 0

Last Operation

ready — pick a target (A or B), enter a value, and click Add / Contains / Remove.
Set algebra buttons produce the Result Set R below.

Operation Log

Statistics

0
|A|
0
|B|
0
|R|
0
Ops

Big-O Complexity

OperationHashSetTreeSet
addO(1)O(log n)
removeO(1)O(log n)
containsO(1)O(log n)
A ∪ BO(|A|+|B|)O(|A|+|B|)
A ∩ BO(min)O(|A|+|B|)
A \ BO(|A|)O(|A|+|B|)
A ▵ BO(|A|+|B|)O(|A|+|B|)

Legend

x — in A
x — in B
x — in R
x — just added
x — found by contains
x — being removed