binary-type-tree
Version:
Binary Trees written in TypeScript
71 lines (70 loc) • 2.14 kB
TypeScript
/**
* Shuffle numbers in array
* @param nums
* @returns {number[]}
*/
export declare const shuffleNumbersArray: (nums: number[]) => number[];
/**
* Return an array with the numbers from 0 to n-1, in a random order.
* @param n
* @returns {number[]}
*/
export declare const getRandomArray: (n: number) => number[];
/**
* Default compareKeys function
* @param a
* @param b
* @returns {number}
* if a < b then return -1
* if a > b then return 1
* if a === b then return 0
* else throw could not compare error.
*/
export declare const defaultCompareKeysFunction: (a: string | number | boolean, b: string | number | boolean) => number;
/**
* Default compareValues function
* @param a
* @param b
* @returns {number}
* if a < b then return -1
* if a > b then return 1
* if a === b then return 0
* else throw could not compare error.
*/
export declare const defaultCompareValues: (a: (string | number)[], b: (string | number)[]) => number[];
/**
* Check whether two keys are equal with '==='
* @param a
* @param b
* @returns {boolean}
*/
export declare const defaultCheckKeyEquality: (a: string | number | Date, b: string | number | Date) => boolean;
/**
* Check whether to values are equal
* @param a
* @param b
* @returns {boolean}
*/
export declare const defaultCheckValueEquality: (a: string | number | Date, b: string | number | Date) => boolean;
/**
* get array with number of items in each row. [1,2,4,8,16] depending
* on the height of the btree
* @param height
* @returns {number[]}
*/
export declare const getRowsArrayFromHeight: (height: number) => number[];
/**
* create an array based on the height of the bTee to insert nodes key
* and value. example: height 3, [ [], [], [], [] ]. 3-0
* @param height
* @returns {any}
*/
export declare const createRefArrayFromTreeHeight: (height: number) => any[];
/**
* Create the reference index master array. This tells another method
* where the nodes need to be inserted in the final array that is turned
* into JSON.
* @param refArray
* @returns {any[]}
*/
export declare const createRandomSortedIndex: (refArray: any[]) => Promise<any[]>;