Data Types Flashcards
(15 cards)
What are queues
Queues are first in first out data structure.
What are linked list?
Linked list are lost where each item contains the address of the next time in the list
What’s an example of a queue
A video buffer is an example of a use for a queue.
Printing job, simulation
What operation can be carried out on a queue
- add a new item to the rear of the queue
- remove an item from the front of the queue
- check whether queue is empty
- return value of the first element and remove it
What are the 3 different types of queues
Circular queues, linear queues and priority queues
What are circular queues
A circular queue is a queue which has a fixed amount of space and where both end are treated as being connected together.
What are the two variable that a circular queue require
A circular queue requires one variable which points to the head and the other the tail of the queue
What are linear queues
Linear queues are queues where elements are always added at one end of a list and removed at the other end.
What are priority queues
Priority queues are queues where items are removed in order of their priority, regardless of the order In which the items are added
How can you check if a circular queue is empty without using a special empty variable?
Head==Tail
How can you check if a circular queue is full without using a special full variable
Head == tail + 1
What are stacks?
Stacks are last in first out data structure. Used when data added last is required first.
What’s the most common use for stacks?
Calling procedures during a program.
What are the operations that can be carried out by stacks
- Check whether the stack is empty
- check whether the stack is full or not
- Look at the top value and remove it (pop)
- put a new value on top of the existing stacks (push)
How to determine whether the stack is empty
Empty stack has topofstack value of zero.