Queue exercises
- Karla G
- 28 mar 2015
- 1 Min. de lectura
Questions
1.- Mention two elements in life where queues are used.
2.- How is queue organized in inputs and outputs?
FIFO, or FILO
(First in, First Out or First in, Last out)
3.- If I have a array: QUEUE[QUEUE.SIZE], when QUEUE.SIZE=6. The initial state of the array is:
[0] [1] [2] [3] [4] [5]
3 34 5 / / / when "/ "= empty
And then, this codes are run:
push(4);
push(2);
pop();
pop();
pop();
pop();
push(23);
pop();
pop();
What is the final state of the array?
Answers:
1.- Video reproduction, Music playlist, waiting in a line, downloads, etc.
2.- FIFO, First in, first out.
3.-
[0] [1] [2] [3] [4] [5]
/ / / / / / when "/ "= empty
Comments