typescript-ds-lib
Version:
A collection of TypeScript data structure implementations
27 lines (26 loc) • 693 B
TypeScript
import { BaseCollection } from "./base-collection";
export interface Stack<T> {
push(element: T): void;
pop(): T | undefined;
top(): T | undefined;
}
export declare class Stack<T> extends BaseCollection<T> implements Stack<T> {
private llData;
constructor();
/**
* Checks if the stack is empty. Returns true if the stack is empty, false otherwise.
*/
isEmpty(): boolean;
/**
* Returns the number of elements in the stack. The size of the stack
*/
size(): number;
/**
* Removes all elements from the stack.
*/
clear(): void;
/**
* Checks if two stacks are equal.
*/
equals(other: Stack<T>): boolean;
}