javascript-algorithms icon indicating copy to clipboard operation
javascript-algorithms copied to clipboard

read-black-tree

Open 15890182384 opened this issue 3 years ago • 4 comments

15890182384 avatar Sep 26 '22 09:09 15890182384

let tree = new RedBlackTree(); tree.insert(5); tree.insert(10); tree.insert(8); At this time, the parent pointer of 10 is null;

15890182384 avatar Sep 26 '22 09:09 15890182384

let tree = new RedBlackTree(1); tree.insert(5); tree.insert(10); tree.insert(8); At this time, the parent pointer of 10 is null;

runnyren avatar Sep 26 '22 12:09 runnyren

let tree = new RedBlackTree(1); tree.insert(5); tree.insert(10); tree.insert(8);

if (!tree.root.right || !tree.root.right.right) { console.error("The parent pointer of 10 is null"); }

This version of the code uses a conditional statement to check if the parent pointer of 10 is null, and if so, it logs an error message.

Skilly55 avatar Feb 13 '23 06:02 Skilly55