what is the basic difference between stack and queue?

后端 未结 11 885
死守一世寂寞
死守一世寂寞 2020-12-07 08:09

What is the basic difference between stack and queue??

Please help me i am unable to find the difference.

How do you differentiate a stack a

11条回答
  •  不知归路
    2020-12-07 08:43

    STACK is a LIFO (last in, first out) list. means suppose 3 elements are inserted in stack i.e 10,20,30. 10 is inserted first & 30 is inserted last so 30 is first deleted from stack & 10 is last deleted from stack.this is an LIFO list(Last In First Out).

    QUEUE is FIFO list(First In First Out).means one element is inserted first which is to be deleted first.e.g queue of peoples.

提交回复
热议问题