Repaso
EspaƱol
Algorithms & DSFoundationsALG-51

What is a data structure?

Options

  1. A way to organize data, like a list, set or tree (Correct option)
  2. A building plan for the rooms of a server farm
  3. A password that protects the data of a database
  4. A type of error that the compiler can raise

Answer

A way of organizing and storing data so it can be used efficiently, such as a list, dictionary, set or tree

Why

Data has to be arranged somehow in memory. Different arrangements make different operations fast or slow.

  • List/array: access by position is fast.
  • Dictionary (hash map): look up a value by key is fast.
  • Set: check membership and keep unique values.
  • Stack and queue: control the order in which items come out.

Choosing the right data structure is half of solving most interview problems.

Remember

Data structure = how data is organized in memory.

Key terms

Practice this question in Repaso