Anonymous
public text v1 · immutable Num of Ops
Algorithm enqueue(o)
in_stack.push(o) 1
Algorithm dequeue()
if (out_stack.isEmpty()) then 2
while (!in_stack.isEmpty()) do n + 2
out_stack.push(in_stack.pop()) 2(n + 2)
if (out_stack.isEmpty()) then 2
throw a QueueEmptyException 1
return out_stack.pop() 1