Data Structures Flashcards
Define static data structures (e.g. arrays)
A static data structure has a fixed size so can waste or run out of space; fixed region of main memory so element can be directly accessed (by index number) as always in the same place.
Define dynamic data structures (e.g. linked lists)
A dynamic data structure can grow; each index made up of data and point to the next index. Needs external point (start) to first index and the last index has a null pointer.
Define a pointer in terms of data structures
A reference variable that contains a memory location.
Define a heap in terms of data structures
Memory available to applications / programs for dynamic allocation at runtime.
Define memory leakage in terms of data structures
Memory locations not returned to heap when no longer referenced.
Define an abstract data type
A complex data type that exists in the real world.
Define a stack as a data structure
A LIFO (Last in, First out) data structure. Needs 1 pointer at the top of stack. Used to store a functions data when another is called using a stack frame.
Define the methods a stack should have
Push - Adding to a stack. Pop - Removes from a stack. Peek - Allows top item to be viewed. IsEmpty - Check if the stack is empty. IsFull - Check if the stack is full.
Define a queue as a data structure
A FIFO (First in, First out) data structure. Needs a pointer at the head (start) and at the tail (end) of the queue. (Can be linear or circular).
Define a priority queue as a data structure
Elements join after all others of same priority and / or before those of lower priority.
Define a graph as a data structure
An ADT (Abstract data type) that is a set of nodes (vertices) and connections between them known as edges (arcs). Can be used to represent computer and social networks, maps, mazes etc. Can be directed and / or weighted.
Suggest when to use an adjacency matrix to store a graphs data
if the number of edges are large compared to fewer nodes (makes it quicker to search).
Suggest when to use an adjacency list to store a graphs data
if the number of edges / connections are fewer compared to more nodes.
Define a tree in terms of data structures
A graph that is fully connected, undirected with no cycles
Define a rooted tree in terms of data structures
A tree where one node (vertex) is designated as the root with every edge (arc) directed away from the root