1.4.2: data structures

Cards (24)

  • What is an array
    An ordered, finite set of elements of a single type
  • What type of array is a linear array?
    A one dimensional array.
  • How can you visualise a two dimensional array?
    You can visualise it as a spreadsheet/table.
  • How can you visualise a three dimensional array?
    A three dimensional array can be visualised as a multi-page spreadsheet
  • What is a record also known as?
    A row in a file
  • What is a record made up of?

    A record is made up of fields
  • How can you identify a field from a record using programming?
    recordName.fieldName
  • What is the definition of a list?
    A data structure consisting of a number of items, where the items can occur more than once.
  • What are the main differences between arrays and lists?
    • Lists can store data non-contiguously whereas arrays store data in order.
    • Lists can store data of more than one data type.
  • What is a tuple?

    An immutable, ordered set of values of any type.
  • What is the difference between a tuple and an array?
    Tuples are initialised using regular brackets instead of square brackets.
  • What is a stack?
    A last in first out data structure, where items can only be removed from and added to the top of the list
  • Give an example of where stacks may be used
    • Back button in a web page
    • Undo buttons
  • What is a queue
    A first in first out data structure, where items are added to the end of the queue and removed from the front of the queue.
  • What does the operation isEmpty() do?
    Checks to see if the stack is empty
  • What does the operation push(value) do?
    Adds a new value to the top of the stack
  • What does the operation peek() do

    Returns the top value of the stack without removing it
  • What does the operation pop() do?
    Returns and removes the value at the top of the stack
  • What does the operation size() do?
    It returns the size of the stack
  • What does the operation isFull() do?

    Checks to see if the stack is full
  • What does the operation enQueue(value) do?
    Adds the value to the end of the queue
  • What does the operation deQueue() do?
    Removes the item from the end of the queue
  • What does the operation isEmpty() do?

    It checks to see if the queue is empty
  • What does the operation isFull() do?
    Checks to see if the queue is full