import { CompareFn } from '..';
import { AATreeNode } from './aaTreeNode';
import { Edge } from './binaryTreeUtils';
import { SortedTree } from './sortedTree';
import { LinkedNode } from 'src/list';
/**
 * An AA tree is a form of balanced tree used for storing and retrieving ordered data efficiently
 * ([source](https://en.wikipedia.org/wiki/AA_tree)).
 *
 * AA trees are named for Arne Andersson, their inventor. They are a variation of the red–black tree,
 * which supports efficient addition and deletion of entries. Unlike red–black trees, additional
 * constraints on the balancing mechanism greatly simplifies the implementation as well as
 * maintenance operations; While a red–black tree needs to consider seven different shapes
 * to properly balance the tree, an AA tree only needs to consider two shapes.
 *
 * The performance of an AA tree is equivalent to the performance of a red–black tree.
 * While an AA tree makes more rotations than a red-black tree, the simpler algorithms
 * tend to be faster, which balances out to similar performance. A red-black tree is
 * more consistent in its performance, but an AA tree tends to be flatter, which results
 * in slightly faster search times.
 */
export declare class AATree<T> implements SortedTree<T> {
    /**
     * The function to determine the order of elements.
     */
    protected compare: CompareFn<T>;
    /**
     * Indicates how to handle duplicates:
     * - < 0 : Add to left subtree
     * - = 0 : Do now allow duplicates
     * - > 0 : Add to right subtree
     */
    protected dupeWeight: number;
    /**
     * The number of elements in the list.
     */
    protected length: number;
    /**
     * The node at the "top" of the heap.
     */
    protected root: AATreeNode<T> | undefined;
    /**
     * Instantiate a tree.
     *
     * @param compareFn - The function to determine the order of elements.
     * @param elements - A set of elements to initialize the tree with.
     */
    constructor(compareFn: CompareFn<T>, elements?: Iterable<T>);
    /**
     * Instantiate a tree.
     *
     * @param compareFn - The function to determine the order of elements.
     * @param allowDuplicates - Whether to allow duplicates
     * @param elements - A set of elements to initialize the tree with.
     */
    constructor(compareFn: CompareFn<T>, allowDuplicates: boolean, elements?: Iterable<T>);
    add(element: T): this;
    clear(): void;
    comparator(): CompareFn<T>;
    delete(element: T): boolean;
    has(element: T): boolean;
    max(): T | undefined;
    min(): T | undefined;
    pop(): T | undefined;
    shift(): T | undefined;
    get size(): number;
    sorted(): Iterable<T>;
    /**
     * Receive an iterator through the list.
     *
     * **Note:** Unexpected behavior can occur if the collection is modified during iteration.
     *
     * @returns An iterator through the list
     */
    [Symbol.iterator](): Iterator<T>;
    update(curElement: T, newElement: T): boolean;
    protected build(obj: Iterable<T>): void;
}
/**
 * @internal
 */
export declare function remove<T>(stack: LinkedNode<Edge<AATreeNode<T>>>): boolean;
/**
 * @internal
 */
export declare function skew<T>(node?: undefined): undefined;
export declare function skew<T>(node: AATreeNode<T>): AATreeNode<T>;
export declare function skew<T>(node?: AATreeNode<T>): AATreeNode<T> | undefined;
/**
 * @internal
 */
export declare function split<T>(node?: undefined): undefined;
export declare function split<T>(node: AATreeNode<T>): AATreeNode<T>;
export declare function split<T>(node?: AATreeNode<T>): AATreeNode<T> | undefined;
