Data Structures Flashcards
What is an array?
An ordered, finite set if elements of a single type
What type of array is a linear array?
A 1D array
How can you visualise a 2D array?
As a spreadsheet or table
How can you visualise a 3D array?
As a multi-page spreadsheet
What is a record also known as?
A row in a file
What is a record made up of?
Fields
How can you select a field from a record using pseudocode?
record.Name.fieldName
What is the definition of a list?
A data structure consisting of a number of items in which the items can occur more than once
What is the main difference 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 array?
Tuples are initialised using regular brackets instead of using square brackets
What is a linked list?
A dynamic data structure used to hold an ordered set of items which are not stored in a contiguous location
What is the name given to the items in a linked list?
Nodes
What does each item in a linked list contain?
A data field and another address field called link/ pointer
What is a data field in a linked list?
A field that stores the actual data
What is a pointer field in a linked list?
A field that contains the address of the next item in the list.
What is a directed graph?
A graph in which the edges can only be traversed in one direction
What is a graph?
A data structure consisting of a set of vertices/ nodes connected by edges/ arcs
What is an undirected graph?
A graph in which the edges can be traversed on both directions
What is a weighted graph?
A graph in which the arcs/ edges have a cost to traverse
Give two ways of representing graphs so that they can be understood by computers
- Adjacency Matrix
- Adjacency List
What are the advantages of Adjacency Matrix?
- Convenient to work with
- Easy to add new nodes to
What are the advantages of using an Adjacency List?
Space for large sparse networks
What is a stack?
A LIFO (last in first out) data structure, where items can only be removed from and added to the top of the list