2: Fundamentals of Data Structures Flashcards
n-Dimensional Array
A set of elements with the same data type that are indexed by a tuple of n integers, where a tuple is an ordered list of elements
Abstract Data Structures (7)
- Queue
- Stack
- Graph
- Tree
- Hash table
- Dictionary
- Vector
Static Data Structures
They reserve memory for a set amount of data and cannot be resized
Dynamic Data Structures
They have no limit to the amount of data they can hold so can be resized
Static vs Dynamic Data Structures (6)
- Static data structures have storage size determined at compile-time
- Dynamic data structures can grow during execution
- Static data structures can waste memory if the number of data items stored is small relative to the size of the structure
- Dynamic data structures only take up the amount of storage space required for the
actual data - Dynamic data structures require pointers to the next item whereas static data structures do not
- Static data structures store data in consecutive memory locations whereas dynamic data structures do not
Queue (4)
- Items are added to the back of the queue
- Items are removed from the front of the queue
- Front and rear pointers are used
Linear Queue
Once the maximum number of items has been added to the queue, no more items can be added even if some are removed
Circular Queue
Once the maximum number of items has been added, if some are removed, items are added to the front of the queue
Priority Queue (5)
- Each item has a priority associated with it
- The queue has different points at which items can join the queue according to priority
- They join at the back of the section according to their priority
- If there are no items queued in the correct priority section then they join the queue at the front of the next
lower priority - Items are still taken one at a time from the front of the entire queue
Stack (3)
- Items are pushed to the back of the stack
- Items are popped from the back of the stack
- A top pointer is used for the item at the back
Graph
A data structure used to represent more complex relationships
Weighted Graph
A graph with a value associated with each edge
Vertex / Node
A point on a graph
Edge / Arc
A connection between two vertices
Undirected Graph
A graph where you can traverse an edge either way