mirror of
https://github.com/trekhleb/javascript-algorithms.git
synced 2026-03-13 08:51:02 +08:00
Make it possible to attach meta information to binary tree node.
This commit is contained in:
@@ -2,13 +2,15 @@ import Comparator from '../../utils/comparator/Comparator';
|
||||
|
||||
export default class BinaryTreeNode {
|
||||
/**
|
||||
* @param {*} [value]
|
||||
* @param {*} [value] - node value.
|
||||
* @param {Object} meta - any meta information that needs to be attached to the node.
|
||||
*/
|
||||
constructor(value = null) {
|
||||
constructor(value = null, meta = {}) {
|
||||
this.left = null;
|
||||
this.right = null;
|
||||
this.parent = null;
|
||||
this.value = value;
|
||||
this.meta = meta;
|
||||
|
||||
// This comparator is used to compare binary tree nodes with each other.
|
||||
this.nodeComparator = new Comparator();
|
||||
|
||||
Reference in New Issue
Block a user