Skip to content

Instantly share code, notes, and snippets.

@korziee
korziee / btree.ts
Last active March 10, 2023 03:53
Balancing binary search tree implementation
type Tree = {
id?: number;
value?: number | string;
left?: Tree;
right?: Tree;
};
class BinaryTree {
private idCounter = 0;
public tree: Tree = { left: {}, right: {}, id: this.idCounter };