Bifalgorithm post · Brisk · Chapter 1
How are sets different from computer collections in size and type?
How are sets different from computer collections in size and type? (Brisk · Chapter 1) — "Infinite sets. ’Nuff said. I’ve never seen an array with infinitely m…
Ideas in this flowchart
- Infinite sets can be heterogeneous, unlike common computer collections.
- Sets may be infinite, although computer arrays are not encountered with infinitely many elements.
- Most program collections contain elements of a single type.
- A uniform type allows the program to treat all collection elements in the same way.
- Mixing incompatible types can cause problems during operations or searches.
- Sets can be heterogeneous and contain different kinds of things.
- One example is X = { Jack Nicholson, Kim Kardashian, Universal Studios, 5786, F }.
- Programming languages generally provide ways to create heterogeneous collections.
- In Java, a non-generic ArrayList can hold items of class Object.
- In C, an array of void pointers can point to different kinds of things.
- In strongly typed languages, heterogeneous collections can feel like an unnatural workaround, unlike in Perl or JavaScript.
- Sets are often intentionally restricted to one type, so their universe Ω is homogeneous.
