implementation of stack using queuqe

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • swagat12
    New Member
    • Mar 2010
    • 1

    implementation of stack using queuqe

    How to implement a stack using queuqe
  • jkmyoung
    Recognized Expert Top Contributor
    • Mar 2006
    • 2057

    #2
    In general, it's a pretty bad idea.
    There's a couple avenues you could take. Did you want to use a double queue option to implement the stack?

    Or are you talking Singly Linked List? That would make a lot more sense.

    Comment

    • donbock
      Recognized Expert Top Contributor
      • Mar 2008
      • 2427

      #3
      What do you mean by queue?

      As abstract software engineering terms, a stack is a last-in-first-out (LIFO) structure, while a queue is a first-in-first-out (FIFO) structure. These are fundamentally incompatible. However, actual implementations of stacks and/or queues sometimes sacrifice conceptual purity for flexibility that might be used to breach the incompatibility .

      Comment

      Working...