enqueue(Q,Elem): | Input queue Q, element Elem | Output Q with Elem added at the end | | Q.top=Q.top+1 | for all i=Q.top down to 1 do | Q[i]=Q[i-1] | end for | Q[0]=Elem | return Q