All pastes #39632 Raw Edit

Anonymous

public text v1 · immutable
#39632 ·published 2006-02-02 16:27 UTC
rendered paste body
                                                       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