Data Structures

?
  • Created by: kinah
  • Created on: 08-06-13 17:12

Stacks

  • First In Last Out (FILO)
  • Items are pushed on to the stack (added on top)
  • Or popped (taken off from the top) 

E.g. Quick sort keeps track of its own values via a stack

1 of 6

Queues

  • First In First Out (FIFO)
  • You enqueue a new item (add to the end)
  • Or dequeue an item (retrieve item from front of queue)

E.g. Printing queue

2 of 6

Binary Trees

  • Data stored in a system of interconnected nodes
  • Starting node is called the root node
  • Each node as two child nodes at most 
  • A child node is a node branching off from another node (parent node)
  • An Ordered Binary Tree keeps nodes which are smaller values to the left and larger values to the right
3 of 6

Arrays

  • Number of elements is defined before using the array
  • All elements must be of the same data type
  • Can be accessed by index number e.g. arr[0] accesses the first element in the array "arr"

E.g. A list of marks for a specific test 

  • A 2D array is like a table with rows and columns
  • An element is accessed via 2 numbers e.g. arr[0,0] points to the first column in the first row

E.g. A table of student test results over a month

4 of 6

Linked Lists

  • Doesn't require you to state number of elements in list beforehand
  • Not vital for all elements to be of one data types (however they tend to be)
  • Nodes are connected to eachother by pointers to the next node. 
  • Only takes up space that is required 
  • The pointer starts at the first node
  • The last node points to a rogue value (an invalid index e.g. -1 or null)
  • Adding/removing data is as simple as changing the pointer of a node

E.g. A list of cities

5 of 6

Records

  • A collection of variables of different data types which relate to each other
  • Useful in database systems
  • Records are made up of fields

E.g. A student record holding data on name, DOB, home address...

6 of 6

Comments

No comments have yet been made

Similar Computing resources:

See all Computing resources »