Fundamentals of Data Structures Flashcards
What is an array
An array is an indexed set of elements. An array must be finite, indexed and must only contain elements with the same data types.
What is a queue
A queue is an abstract data structure based on an array. Queues are FIFO abstract data structures (First in First out)
What is a Linear Queue
A linear queue has two pointers, a front pointer and a rear pointer. The queue is full if there are no available positions on or after the rear pointer.
What is a Circular Queue
A circular queue is a queue in which the front and rear pointers can move over the two ends of the queue, making for a more memory efficient data structure.
What is a Priority Queue
In a priority queue, items are assigned a priority. Items with the highest priority are dequeued before low priority items. If two items have the same priority, FIFO is used.
Name 3 operations that can be performed on a queue
Enqueue
Dequeue
IsEmpty
IsFull
What is a stack
A stack is a FILO (first in last out) abstract data structure. Stacks have just one pointer, a top pointer.
Name 3 operations that can be performed on a stack
Push
Pop
PeekIsFull
IsEmpty
What is a stack overflow error
When you attempt to add an item to a stack with no available spaces
What is a stack underflow error
When you attempt to pop an item from an empty stack
What is a graph
A graph is an abstract data structure used to represent complex relationships between items within datasets. A graph consists of nodes (vertices) which are joined by edges (arcs).
What is the difference between a graph and a weighted graph.
A weighted graph is one in which edges are assigned a value, representing a value such as time, distance, cost, etc.
What is an Adjacency Matrix
An adjacency matric is a tabular representation of a graph, each of the nodes in the graph is assigned both a row and a column in the table, a 1 is used to show an edge exists between 2 nodes and a 0 indicates that there is no connection. (if the graph is weighted, use the weight instead of 1, and infinity instead of 0)
What is an Adjacency List
Rather than using a table to represent a graph, a list can be used. For each node in the graph, a list of adjacent nodes is created, this means that only existing connections are stored, which is more memory efficient.
What is a tree
A tree is a connected, undirected graph with no cycles.