Is there any literature / research on the average size efficiency of stacks vs queues?  I asked because I was recently working on a problem where, if using a queue, the size quickly blew up and the computer ran out of memory.  If I used a stack the size stayed very small.I think the reason in this case was that the search space was wide but shallow, which depth-first or LIFO optimal.  I imagine that if it were narrow but deep a queue would have worked better.Update: The algorithm was basically counting the number of palindromes which are substrings of a given string.  My algorithm worked from the outside, pairing off letters and then sending the rest of the string back onto a stack/queue to be paired again.Say there are 50 letters in the string, and 3 are already processed.  The number of possible substrings with 47 digits is 2^47, so if I push these all to the queue before processing the next digit it blows up.  But the stack would not push all 2^47 before processing the next string with 46 unprocessed, etc.It comes back to what I said before about the size of the search space being much wider than it is deep - in this case the width is 2^50 and the depth is 50.  So the stack is much more efficient.  I just was wondering if there are any proven results related to this.
stack vs queue efficiency
data structures;efficiency;stacks;queues