Category: Stack

Queue using two stacks javascript 0

Queue using two stacks javascript

Problem : Implement queue’s enqueue and dequeue operations using two stacks. Logic: The queue is first-in-first-out and a stack is last in-first-out phenomena. Hence, the main difference between these two data structures is that...


Sort the stack in ascending order

Problem : Sort the given stack into an ascending order without using recursion. Logic: Pop an item from the original stack and push it onto the sorted stack. If the poped item from the...

Tower of hanoi 0

Tower of hanoi

Problem : The Towers of Hanoi is a classic puzzle with 3 pegs and multiple disks of different sizes. The goal of the puzzle is to move all the disks from the first peg...

Implement a stack using javascript 0

Implement a stack using javascript

Problem description : Create a stack data structure in javascript. Stack organizes data into the sequential order. It similar to the stack of books in a library or stack of dishes in the kitchen...

Show Buttons
Hide Buttons