What are the differences between vectors, sets, and tuples in programming?
Mathematically
A tuple has properties that distinguish it from a set.
- A tuple may contain multiple instances of the same element, so tuple (1,2,2,3) != (1,2,3) but set {1,2,2,3} = {1,2,3}.
- Tuple elements are ordered: tuple (1,2,3) != (3,2,1), but set {1,2,3} = {3,2,1}.
- A tuple has a finite number of elements, while a set or a multiset may have an infinite number of elements.
Vector is a different type represented by multiple tuples.
Cheers :-)