AIOC Banner

Problem: Queues 2

Want to try solving this problem? You can submit your code online if you log in or register.


Queues 2

Input File: queuesin.txt
Output File: queuesout.txt

Original question:

Implement a queue and show it off by writing an equivalent programme to the one in Stacks.

You may assume that your queue does not grow beyond 100 levels deep.

Sample input:

1
2
3
-1
-1
4
-1
-1
-2

Sample output:

1
1 2
1 2 3
2 3
3
3 4
4
queue is empty!

 


Privacy statement
© Australian Mathematics Trust 2001-2024

Contact: training@orac.amt.edu.au
Page generated: 28 March 2024, 11:58pm AEDT