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

@@ -10,7 +10,7 @@ pub fn AVLTree(comptime T: type) type {
return struct {
const Self = @This();
root: ?*inc.TreeNode(T) = null, // 根
root: ?*inc.TreeNode(T) = null, // 根
mem_arena: ?std.heap.ArenaAllocator = null,
mem_allocator: std.mem.Allocator = undefined, // 内存分配器
@@ -59,7 +59,7 @@ pub fn AVLTree(comptime T: type) type {
// 更新结点高度
self.updateHeight(node);
self.updateHeight(child);
// 返回旋转后子树的根
// 返回旋转后子树的根
return child;
}
@@ -73,7 +73,7 @@ pub fn AVLTree(comptime T: type) type {
// 更新结点高度
self.updateHeight(node);
self.updateHeight(child);
// 返回旋转后子树的根
// 返回旋转后子树的根
return child;
}
@@ -132,7 +132,7 @@ pub fn AVLTree(comptime T: type) type {
self.updateHeight(node); // 更新结点高度
// 2. 执行旋转操作,使该子树重新恢复平衡
node = self.rotate(node);
// 返回子树的根
// 返回子树的根
return node;
}
@@ -171,7 +171,7 @@ pub fn AVLTree(comptime T: type) type {
self.updateHeight(node); // 更新结点高度
// 2. 执行旋转操作,使该子树重新恢复平衡
node = self.rotate(node);
// 返回子树的根
// 返回子树的根
return node;
}

View File

@@ -18,7 +18,7 @@ fn hierOrder(comptime T: type, mem_allocator: std.mem.Allocator, root: *inc.Tree
while (queue.len > 0) {
var queue_node = queue.popFirst().?; // 队列出队
var node = queue_node.data;
try list.append(node.val); // 保存结点
try list.append(node.val); // 保存结点
if (node.left != null) {
var tmp_node = try mem_allocator.create(L.Node);
tmp_node.data = node.left.?;