|In that case, I'm not sure you get any performance gain since the queue |has basically the same role as the stack in the recursive version. A |definitive answer calls for an actual test, though. The potential gain comes from not incurring function call overhead and only queueing or stacking the exact data needed.