/*! * Copyright (c) Microsoft Corporation and contributors. All rights reserved. * Licensed under the MIT License. */ /** * Interface for a comparer. * * @deprecated Moved to the `@fluidframework/core-utils` package. * @internal */ export interface IComparer { /** * The minimum value of type T. */ min: T; /** * Compare the two value * * @returns 0 if the value is equal, negative number if a is smaller then b, positive number otherwise */ compare(a: T, b: T): number; } /** * A comparer for numbers. * * @deprecated Moved to the `@fluidframework/core-utils` package. * @internal */ export declare const NumberComparer: IComparer; /** * Interface to a node in {@link Heap}. * * @deprecated Moved to the `@fluidframework/core-utils` package. * @internal */ export interface IHeapNode { value: T; position: number; } /** * Ordered {@link https://en.wikipedia.org/wiki/Heap_(data_structure) | Heap} data structure implementation. * * @deprecated Moved to the `@fluidframework/core-utils` package. * @internal */ export declare class Heap { comp: IComparer; private L; /** * Creates an instance of `Heap` with comparer. * @param comp - A comparer that specify how elements are ordered. */ constructor(comp: IComparer); /** * Return the smallest element in the heap as determined by the order of the comparer * * @returns Heap node containing the smallest element */ peek(): IHeapNode; /** * Get and remove the smallest element in the heap as determined by the order of the comparer * * @returns The smallest value in the heap */ get(): T; /** * Add a value to the heap * * @param x - value to add * @returns The heap node that contains the value */ add(x: T): IHeapNode; /** * Allows for the Heap to be updated after a node's value changes. */ update(node: IHeapNode): void; /** * Removes the given node from the heap. * * @param node - The node to remove from the heap. */ remove(node: IHeapNode): void; /** * Get the number of elements in the Heap. * * @returns The number of elements in the Heap. */ count(): number; private fixup; private isGreaterThanParent; private fixdown; private swap; } //# sourceMappingURL=heap.d.ts.map