Skip to content
PathTailor
  • Courses
  • Paths
  • Careers
  • Glossary
  • Companies
  • Schools
  • Pricing
FRSign inBuild my path
PathTailor
  • Courses
  • Paths
  • Careers
  • Glossary
  • Companies
  • Schools
  • Pricing
Build my pathSign inLire en français
  1. Home
  2. Glossary
  3. Set

Set

A set (set) is a collection of unique, unordered elements, also based on a hash table. The membership test is O(1) on average. It is used to deduplicate and to compute union, intersection and difference.

Example

a = {1, 2, 3}
b = {2, 3, 4}
a & b  # {2, 3}

Related concepts

Hash tableDictionaryTime complexityBig O notationSpace complexityDynamic array (list)SortingBinary searchStack (LIFO)Queue (FIFO)Heap and priority queueTrees

The whole glossary

See this concept in action

Want to go further? Take the Data Structures and Complexity course.

Lesson 3 of 5 · 20 min · intermediate level

Dictionaries and Sets: The Power of Hashing

In this lesson, you learn to:

  • understand the principle of a hash table
  • choose between list, dict and set depending on the use case
  • solve classic problems in O(n) using hashing

See the courseBuild my path

PathTailor

Your project. Our path.

Courses are being translated into English; those not yet translated open in French. Personalised lessons are produced in the learner's language.

Build my path

Catalogue

  • All courses
  • Paths
  • Careers
  • Glossary

Platform

  • Pricing
  • Blog (French)
  • About

Organisations

  • Companies
  • Schools

Catalogue updated on 12 November 2026 · v1.1 · Legal notice · Terms · Privacy · Cookies ·