1.4.2 - Data Structures Flashcards
What is an array?
An ordered, finite set of elements of a single data type.
What does zero-index mean?
The first element in the array is considered to be at position zero.
What is a list?
A data structure consisting of a number of ordered items where the items can occur more than once.
They can store values of different data types and they are stored non-contiguously.
What is a tuple?
An ordered set of values of any type. A tuple is immutable which means it cannot be changed.
What is a linked list?
A dynamic data structure used to hold an ordered sequence.
Each item contains an index, a data field and a pointer to the next index.
What is a graph?
A graph is a set of vertices or nodes connected by edges.
What are the three types of graphs?
Directed, undirected and weighted.
What is a directed graph?
The edges can only be traversed in a single direction.
What is an undirected graph?
The edges can be traversed in both directions.
What is a weighted graph?
A ‘weight’ is attached to each edge.
What are the two ways computers are able to process graphs?
Using an adjacency matrix or an adjacency list.
What is an adjacency matrix?
A table that contains all of the possible connections between a graph.
What is an adjacency list?
A list that contains all of the links for a node of the array.
What are the advantages of an adjacency matrix?
Convenient to work with due to quicker access times.
Easy to add nodes.
What are the advantages of an adjacency list?
More space efficient for large, sparse graphs.