Module 1 · Getting Started · Lesson 1 of 40

What are data structures and algorithms?

Two simple ideas behind every program: how you store data, and the steps you follow to use it.

In this lesson · about 12 minutes

  • Say what a data structure is, in your own words
  • Say what an algorithm is, in your own words
  • Explain why the choice of structure can make a program fast or slow

Welcome! This course teaches you data structures and algorithms, often shortened to DSA. The words sound big, but the ideas are simple. You already use them every day.

A data structure is a way to store things

Think about your kitchen. Spoons go in a drawer. Plates go in a stack. Spices go on a shelf, each with a label. Each place is chosen so you can find things quickly.

A data structure is the same idea for a computer. It is a way to store data so that the jobs you need to do are easy and fast. A shopping list, a phone book and a pile of plates are all data structures.

An algorithm is a list of steps

A recipe is a list of steps: boil water, add pasta, wait ten minutes. An algorithm is a list of clear steps that solves a problem. "Look at each name in the list until you find Sara" is an algorithm.

Why do we care?

Imagine a phone book with one million names. If the names are in random order, you may need to read all one million to find one person. If they are in alphabetical order, you can open the middle, see if your name comes before or after, and throw away half the book each time. You find anyone in about 20 looks.

Same data, different structure and algorithm, and the work drops from a million steps to 20. That is what this course is about: picking the right structure and the right steps.

Your first run: two ways to find a name

Press Run. The first run takes a few seconds while Python loads in your browser. The code counts how many names each method has to look at.

Sorting drill

Structure or algorithm?

Put each item in the right group.

  • A shopping list
  • A pile of plates
  • A recipe for tea
  • Directions to a friend's house
  • A phone book sorted A to Z
  • Open the middle of the book, then go left or right

0 of 6 sorted

Key terms

Say the meaning to yourself, then tap a card to check.

Check your understanding0 of 3 correct

Question 1

1.Which one is a data structure?

Question 2

2.Why can a sorted phone book be searched so fast?

Question 3

3.What is an algorithm?

Quiz score: 0 of 3

Tip: answer every quiz question correctly first.

Noviq Academy is free and for learning. This course follows the topics of a set of DSA study notes, rewritten in Noviq's own words with Python examples. Python runs in your own browser with Pyodide; nothing you type is sent to Noviq.