Data Structures Flashcards
Data Structures
Containers within which information is stored
Arrays
- An indexed, finite set of elements with the same data type
- Can be created in many dimensions
Files
A collection of data stored permenantly on secondary storage
Abstract Data Types
- Don’t exist as data structures in their own right
- Uses other data structures to form a new way of storing data
Queues
- A FIFO abstract data type that is based on an array
- Used in keyboard buffers
Linear Queues
- A fixed length queue with a front and rear pointer
- Once a space has been used it cannot be reused until the queue is reset
Circular Queues
A queues where the front and rear pointers can move over the 2 ends of the queue
Queue Operators
Enqueue, Dequeue, IsEmpty, IsFull
Priority Queues
- Items are assigned a priority that determines when they are dequeued
- Uses a FIFO system for items with equal priority
Stacks
- A FILO abstract data type that is based off an array
- Has a single pointer (the top pointer)
Stack Operations
Push, Pop, Peek, IsFull, IsEmpty
Stack Overflow
Error that occurs when a push command is executed on a full stack
Stack Underflow
Error that occurs when a pop command is executed onto an empty stack
Graph
An abstract data type comprising of nodes (entities) connected by edges (relationships)
Weighted Graph
- A graph where each edge has an assigned value
- Represented by adjacency matrices or adjacency lists
Adjacency Matrices
- A tabular representation of a graph
- Each node is assigned a row and column
Adjacency List
- Represents a graph using a list
- Each node has a list of adjacent nodes
Adjacency List vs Matrix
- Adjacency matrices store every possible edge, even those that do not exist
- Adjacency lists are slow to query as each item in a list must be searched sequentially
- Adjacency matrices are suited to dense graphs with high amounts of edges
Tree
A connected, undirected graph with no cycles
Rooted Tree
A tree with a root node
Root Node
The node from which all other nodes stem
Parent Node
A node from which other nodes stem
Child Node
A node with a parent node
Leaf Node
A child node with no children