Skip to content
dsa450for five year olds

Drawings

Every structure, drawn as what it really is.

A tree is not a row of boxes, so we never draw it as one. These are the twelve drawings used across all the problems. Things that are being looked at lift up off the page, like a key you are pressing.

What the colours mean

  • looking now
  • checking
  • seen
  • done
  • answer
  • rejected
  • path
  • just added
  • ignored

Array

A row of numbered lockers

Little numbers on top are the positions, starting at 0. Black tags underneath are fingers like i and j. A blue bracket marks a window.

array
012345window314159ji
  • looking now
  • checking
  • done

Linked list

A toy train

Each box holds a value and a hook. Arrows show where each hook points. Flipped arrows point left. A dashed red line means the last car hooks back into the train.

linked list
nullnull12345currprev
  • looking now
  • done
linked list
320-4fastslow

Stack and queue

A pile of plates and a lunch line

The stack is a cup: you add and remove at the top. The queue is a lane: you join at the back and leave from the front.

stack
([{top
queue
outin471frontback
  • looking now

Binary tree

A family tree

Lines are parent to child. A blue path is the route being followed. Small blue notes under nodes hold answers like heights or sums.

tree
831016144713leafleafhere
  • looking now
  • path

Heap

A tree living in an array

The heap is drawn twice: as the tree it acts like, and as the array it is stored in. Same colours in both, so you can see where each spot lives.

heap
136598012345136598
  • looking now
  • checking

Any tree

Tries, choices and recursion

Nodes can have many children. Letters on the lines are the choices made. A double ring marks where a word ends or an answer was found.

tree
catrdogcatrdog
  • answer

Graph

Towns and roads

Circles are towns, lines are roads, numbers on lines are lengths. Orange badges hold what we learned about a town, like its distance from the start.

graph
412583ABCDE013
  • looking now
  • done
  • path
graph
542310
  • done

Grid

A chocolate bar of squares

For matrices, boards, mazes and dynamic programming charts. Blue arrows show which squares an answer was built from.

grid
ACBAB000001110112
  • looking now
  • checking

Map and set

A notebook and a bag of marbles

A map pairs each key with a value. A set just remembers what it has seen, each thing once.

map
apple3kiwi1
set
159
  • looking now
  • just added

Bits

A row of light switches

Each number becomes switches. Bit 0 is on the right. Off switches are faded.

bits
012313110112110013 & 121100
  • answer

Timeline

Meetings on a calendar

Each bar is one meeting, job or train. The red dashed line is the time we are looking at.

timeline
012345678ABC
  • done
  • rejected