what are static data structures
organisation or collection of data in memory that is fixed in size
eg arrays
features of static data structures
what is an array
a list with a fixed size
what is a dynamic data structure
a collection of data in memory that has the ability to grow or shrink in size
eg lists
features of dynamic data structures
advantages of dynamic structures
disadvantages of dynamic structures
advantages of static structures
features of a stack
LIFO - last in first out structure,
features of a queue structure
FIFO - first in first out
- you can add items onto the back of the queue and remove items from the front
What does a queue need to be able to do?
what does a stack need to be able to do
Describe the steps involved in adding a record to a hash table.
-Hash algorithm applied;
to key value ;
- result is location in table where the record should be stored (key % number of slots)
- if location is not empty;
then use next free location by incrementing by one
Describe the process that should be followed to add an item to a circular queue
implemented as a static data structure using an array.
1. Check the queue is not already full;
2. Compare the value of the (rear) pointer with the maximum size of the array;
3. If equal then (rear) pointer becomes zero;
4. Otherwise, add one to the (rear) pointer;
5. Insert new item in position indicated by (rear) pointer;
what are abstract data types
a logical description of how the data is viewed and the operations that can be performed on it
where are queues used
what is a stack?
how does a stack operate?
what are some of the common uses of a stack?
uses of static data structures
uses of dynamic data structures
How do you add an item to a linear queue
check the queue is not full.
- if full, report an overflow error and stop
- else, increment the rear pointer
- insert new data item into the location pointed to by the rear pointer
How do you remove an item from a linear queue?
How do you test for an empty linear queue
How do you test for a full linear queue
disadvantages of static data structures
How do you perform a push(insertion) operation on a stack