Retranslate the complete English edition from Simplified Chinese (#2010)

* Retranslate the complete English edition from Simplified Chinese

* Polish three English explanations after reader-focused review
This commit is contained in:
Yudong Jin
2026-10-31 03:35:51 +08:00
committed by GitHub
parent ef46e2ed95
commit 14c314c08c
1502 changed files with 29459 additions and 23517 deletions

View File

@@ -7,29 +7,29 @@
const { TreeNode } = require('../modules/TreeNode');
const { printTree } = require('../modules/PrintUtil');
/* Initialize binary tree */
// Initialize nodes
/* Initialize the binary tree */
// Initialize the nodes
let n1 = new TreeNode(1),
n2 = new TreeNode(2),
n3 = new TreeNode(3),
n4 = new TreeNode(4),
n5 = new TreeNode(5);
// Build references (pointers) between nodes
// Set up references (pointers) between the nodes
n1.left = n2;
n1.right = n3;
n2.left = n4;
n2.right = n5;
console.log('\nInitialize binary tree\n');
console.log('\nInitialize the binary tree\n');
printTree(n1);
/* Insert node P between n1 -> n2 */
/* Insert and remove nodes */
const P = new TreeNode(0);
// Delete node
// Insert node P between n1 and n2 in n1 -> n2
n1.left = P;
P.left = n2;
console.log('\nAfter inserting node P\n');
console.log('\nAfter inserting node P:\n');
printTree(n1);
// Remove node P
n1.left = n2;
console.log('\nAfter removing node P\n');
console.log('\nAfter removing node P:\n');
printTree(n1);