LinkedStack
Container of elements that are inserted and removed according to the LIFO principle. This structure is based on SinglyLinkedList.
new LinkedStack()
/**
* Creates an instance of LinkedStack.
*
* @param elements List of elements to create the new stack with.
*/
constructor(elements: T[] = [])length
length: numberExamples:
import { LinkedStack } from 'ads-js/queues';
const stack = new LinkedStack();
stack.length === 0; // true
stack.push(1);
stack.length === 1; // trueclear()
isEmpty()
Returns:
Examples:
pop()
push()
top()
Last updated