UNPKG

@figliolia/data-structures

Version:

Efficient data structures for every day programming

25 lines (24 loc) 615 B
import { MinMaxStack } from "./MinMaxStack"; /** * Max Stack * * A stack maintaining a reference to it's highest weighted item * * ```typescript * import { MaxStack } from "@figliolia/data-structures"; * * const stack = new MaxStack<number>(value => value); * stack.push(1); // max = 1 * stack.push(2); // max = 2 * stack.push(3); // max = 3 * stack.max // 3 * stack.pop() // max = 2 * ``` */ export declare class MaxStack<T> extends MinMaxStack<T> { max: T | null; private get maximium(); protected setMinMax(val: T): void; protected findMinMax(val: T): void; private findMax; }