Fs Of Data Structures Flashcards
What are the 4 categories for data types?
Strong types
Static types
Dynamic types
Abstract types
Define strong data types.
Standard data types; integer, character etc. They’re the basis for all other types, and a fixed amount of memory is defined.
Define static data types?
Those that require a fixed amount of memory, such as arrays and sets. But are not included in the pre-defined data types.
Define dynamic data types?
Those that may be expanded given the limitation of the memory. For example files and pointers.
What are abstract data types
Abstract means they don’t usually exist as a pre-built data structure but instead must be manually built. Such as stacks and queues.
What structure does a stack have?
LIFO (last in first out)
What sort of structure does a queue have?
FIFO (First in first out)
What are the 3 commands used in stacks?
Pushing = adding an item Popping = taking an item off Peeking = finds the start (bottom) of the stack
What happens to the pointer as an item is pushed or popped?
When an item is popped the pointer moves down.
When an item is pushed the pointer moves up.
What are stack overflow and underflow errors?
Overflow - When an item is pushed onto a full stack.
Underflow - When an item is popped from an empty stack.
What is an advantage and disadvantage of implementing a queue as an array.
Advantage - faster and more memory efficient than a linked list.
Disadvantage - fixed size
What is an advantage and disadvantage to implementing a queue as a linked list?
Advantage - Dynamic size. Means no wasted memory.
Disadvantage - Not as memory efficient as an array. Requires more memory per element.
What operations are needed in a queue?
Add item Remove item Front item Is queue empty Is queue full
What are the 3 types of queue?
Linear queue
Circular queue
Priority queue
Define a linear queue.
A queue with a fixed amount of memory. Usually implemented using a 1D array. Items added to the back and removed from the front, memory can not be re-used.
Define a circular queue.
A queue with a fixed amount of memory.
The back of is connected to the front.
Memory can be re-used.
This is often used to store data waiting to be transferred from one device to another.