Set

noun

say it: “SET” /sɛt/

A collection that holds each item at most once and answers quickly whether an item is in it.

What is a set?

A set holds each item at most once, like a guest list where every name appears one time. It's a hash table that keeps only keys, so checking whether an item is in it is O(1) on average. Making a set from a list removes the duplicates.

In a sentence

  • “Maya scanned her card twice, but the set of visitors holds her name only once.”

Level: Apprentice · More Data Structures terms at this level

Updated

In other subjects