mirror of
https://github.com/krahets/hello-algo.git
synced 2026-11-24 12:42:23 +08:00
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:
@@ -6,7 +6,7 @@
|
||||
|
||||
const { arrToTree } = require('./TreeNode');
|
||||
|
||||
/* Print linked list */
|
||||
/* Print a linked list */
|
||||
function printLinkedList(head) {
|
||||
let list = [];
|
||||
while (head !== null) {
|
||||
@@ -22,7 +22,7 @@ function Trunk(prev, str) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Print binary tree
|
||||
* Print the binary tree
|
||||
* This tree printer is borrowed from TECHIE DELIGHT
|
||||
* https://www.techiedelight.com/c-program-print-binary-tree/
|
||||
*/
|
||||
@@ -30,7 +30,7 @@ function printTree(root) {
|
||||
printTree(root, null, false);
|
||||
}
|
||||
|
||||
/* Print binary tree */
|
||||
/* Print the binary tree */
|
||||
function printTree(root, prev, isRight) {
|
||||
if (root === null) {
|
||||
return;
|
||||
@@ -71,11 +71,11 @@ function showTrunks(p) {
|
||||
process.stdout.write(p.str);
|
||||
}
|
||||
|
||||
/* Print heap */
|
||||
/* Print a heap */
|
||||
function printHeap(arr) {
|
||||
console.log('Heap array representation:');
|
||||
console.log('Array representation of the heap:');
|
||||
console.log(arr);
|
||||
console.log('Heap tree representation:');
|
||||
console.log('Tree representation of the heap:');
|
||||
printTree(arrToTree(arr));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user