Implement C with the linear approach(the monotonous queue).