1. Add build script for Java.

2. Add height limitation for code blocks in extra.css.
3. Fix "节点" to "结点".
This commit is contained in:
krahets
2023-02-07 04:43:52 +08:00
parent b14568151c
commit ecbf2d1560
54 changed files with 457 additions and 1633 deletions

View File

@@ -4,11 +4,9 @@
* Author: Justin (xiefahit@gmail.com)
*/
/**
* 合并左子数组和右子数组
* 左子数组区间 [left, mid]
* 右子数组区间 [mid + 1, right]
*/
/* 合并左子数组和右子数组 */
// 左子数组区间 [left, mid]
// 右子数组区间 [mid + 1, right]
function merge(nums: number[], left: number, mid: number, right: number): void {
// 初始化辅助数组
let tmp = nums.slice(left, right + 1);

View File

@@ -12,7 +12,7 @@ class AVLTree {
root: TreeNode;
/*构造函数*/
constructor() {
this.root = null; //根
this.root = null; //根
}
/* 获取结点高度 */
@@ -45,7 +45,7 @@ class AVLTree {
// 更新结点高度
this.updateHeight(node);
this.updateHeight(child);
// 返回旋转后子树的根
// 返回旋转后子树的根
return child;
}
@@ -59,7 +59,7 @@ class AVLTree {
// 更新结点高度
this.updateHeight(node);
this.updateHeight(child);
// 返回旋转后子树的根
// 返回旋转后子树的根
return child;
}
@@ -113,7 +113,7 @@ class AVLTree {
this.updateHeight(node); // 更新结点高度
/* 2. 执行旋转操作,使该子树重新恢复平衡 */
node = this.rotate(node);
// 返回子树的根
// 返回子树的根
return node;
}
@@ -151,7 +151,7 @@ class AVLTree {
this.updateHeight(node); // 更新结点高度
/* 2. 执行旋转操作,使该子树重新恢复平衡 */
node = this.rotate(node);
// 返回子树的根
// 返回子树的根
return node;
}

View File

@@ -16,7 +16,7 @@ function hierOrder(root: TreeNode | null): number[] {
const list: number[] = [];
while (queue.length) {
let node = queue.shift() as TreeNode; // 队列出队
list.push(node.val); // 保存结点
list.push(node.val); // 保存结点
if (node.left) {
queue.push(node.left); // 左子结点入队
}