August 2020
Intermediate to advanced
508 pages
11h 53m
English
Let’s explore another data structure: the set. A set is a data structure that does not allow duplicate values to be contained within it.
There are different types of sets, but for this discussion, I’ll talk about an array-based set. This set is just like an array—it is a simple list of values. The only difference between this set and a classic array is that the set never allows duplicate values to be inserted into it.
For example, if you had the set ["a", "b", "c"] and tried to add another "b", the computer just wouldn’t allow it, since a "b" already exists within the set.
Sets are useful when you need to ensure that you don’t have duplicate data.
For instance, if you’re creating an online phone ...
Read now
Unlock full access