[x] Do you have Node.js and all the relevant dev-dependencies installed?
[ ] Is this a bug fix?
[x] Is this an enhancement?
[x] Is this a feature request?
NOTE: Provide a clear and concise description of the feature that needs to be added! Or if its a bug, then provide the necessary steps to reproduce it along with screenshots.
Give your answer below:
Stacks are often very useful in competitive programming owing to their LIFO property. Add a data structure with the following function:
Push(data) - Insert data into the stack.
Pop() - Delete the topmost element from the stack.
Top() - Return the topmost element(HEAD) of the stack without popping it.
copy() - Returns a copy passed stack object.
Example: Stack1 = [ 3, 2, 1];
let Stack2 = copy(Stack1);
//Stack2 also stores [3, 2, 1] now
isEmpty() - returns true if the stack has no elements in it. Returns false otherwise.
printStack() - prints all the elements of the stack. (In LIFO Order only.)
Do the checklist before filing the issue:
NOTE: Provide a clear and concise description of the feature that needs to be added! Or if its a bug, then provide the necessary steps to reproduce it along with screenshots.
Stacks are often very useful in competitive programming owing to their LIFO property. Add a data structure with the following function:
Push(data) - Insert data into the stack.
Pop() - Delete the topmost element from the stack.
Top() - Return the topmost element(HEAD) of the stack without popping it.
copy() - Returns a copy passed stack object. Example: Stack1 = [ 3, 2, 1]; let Stack2 = copy(Stack1); //Stack2 also stores [3, 2, 1] now
isEmpty() - returns true if the stack has no elements in it. Returns false otherwise.
printStack() - prints all the elements of the stack. (In LIFO Order only.)
Refer to: https://www.geeksforgeeks.org/implementation-stack-javascript/