Originally posted by: Kenji4861
I was asked this today and just got into some deep thinking.
Is a queue better than a stack or a stack better than a queue?
Assuming the queue is not double ended.
Originally posted by: robothouse77
Originally posted by: Kenji4861
I was asked this today and just got into some deep thinking.
Is a queue better than a stack or a stack better than a queue?
Assuming the queue is not double ended.
what was the deep thinking?
Originally posted by: Kenji4861
well this was an interview question and as you all said, I feel that they both have a reason for their existance.
But there must be some kind of answer to this. I just wanted to hear what everyone had in mind.
Originally posted by: Ipno
I prefer stacks of pancakes to waiting in a queue for something, therefore, I will have to say stacks are better.
Originally posted by: jalaram
That's like asking "Is a string better than an integer?".
Originally posted by: Kenji4861
Originally posted by: jalaram
That's like asking "Is a string better than an integer?".
In that case I think the integer would be better than a string since a sequence of integers can represent a string.
Originally posted by: OulOat
Originally posted by: Kenji4861
Originally posted by: jalaram
That's like asking "Is a string better than an integer?".
In that case I think the integer would be better than a string since a sequence of integers can represent a string.
But string can hold any integer, decimal, float, etc