11456 - Implement a list 3 (front)   

Description

You must follow the rules as below:

1. do not use any static variables

2. do not use any variables which is not inside a function

3. only new, operator new, delete and operator delete are allowed to allocate or deallocate memory

You are required to implement a list.

Input

The input consist of a number of operations. Each operations (push_front, pop_front and show) are separated by a newline character ('\n').

Operation push_front: following by a non-negative integer (insert value, 0<=insert value<65535). Push a node at the begin position with insert value.

Operation pop_front: Pop a node at the begin position.

Operation show: print the value of all nodes in the list. Print a whitespace character (' ') after printing the value of nodes. If the list is empty, do not print anything.

Output

Implement List (constructor, destructor, push_front and pop_front) and operator<<(std::ostream &,const List &).

Sample Input  Download

Sample Output  Download

Partial Judge Code

11456.cpp

Partial Judge Header

11456.h

Tags




Discuss