\Require elements $A[1], A[2], \dots, A[n]$ to be sorted
\Procedure{Iterative-MergeSort}{$A[1..n]$}
\Statex
\State $Q \gets$ empty queue 
\For{$i \gets 1$ \textbf{to} $n$}
  \State $\Call{Inject}{Q, A[i]}$
\EndFor
\While{$|Q|>1$}
  \State $\Call{Inject}{Q, \Call{Merge}{\Call{Eject}{Q}, \Call{Eject}{Q}}}$
\EndWhile
\EndProcedure
