paint-brush
Implement Stack using Queuesby@deft
672 reads
672 reads

Implement Stack using Queues

by Sergey Golitsyn4mSeptember 23rd, 2022
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

A last-in-first-out (LIFO) stack using only two queues. The implemented stack should support all the functions of a normal stack (`push`,`top` and`pop`) You must use only the standard operations of a queue, which means that only `push to back` and `peek/pop from front` are valid. Depending on language, the queue may not be supported natively. You may simulate a queue using a list or deque (double-ended queue) as long as you use only a queue's standard operations.
featured image - Implement Stack using Queues
Sergey Golitsyn HackerNoon profile picture
Sergey Golitsyn

Sergey Golitsyn

@deft

Senior Software Engineer with 7+ YoE building massively scalable systems both from scratch and diving into a codebase

About @deft
LEARN MORE ABOUT @DEFT'S
EXPERTISE AND PLACE ON THE INTERNET.
0-item

STORY’S CREDIBILITY

DYOR

DYOR

The writer is smart, but don't just like, take their word for it. #DoYourOwnResearch

L O A D I N G
. . . comments & more!

About Author

Sergey Golitsyn HackerNoon profile picture
Sergey Golitsyn@deft
Senior Software Engineer with 7+ YoE building massively scalable systems both from scratch and diving into a codebase

TOPICS

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite