Skip to content

Commit

Permalink
revert change and update appendix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
hpstory committed Nov 24, 2023
1 parent 326e110 commit e18f1d6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions codes/csharp/chapter_tree/array_binary_tree.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@ public int Size() {
}

/* 获取索引为 i 节点的左子节点的索引 */
public static int Left(int i) {
public int Left(int i) {
return 2 * i + 1;
}

/* 获取索引为 i 节点的右子节点的索引 */
public static int Right(int i) {
public int Right(int i) {
return 2 * i + 2;
}

/* 获取索引为 i 节点的父节点的索引 */
public static int Parent(int i) {
public int Parent(int i) {
return (i - 1) / 2;
}

Expand Down Expand Up @@ -108,9 +108,9 @@ public void Test() {

// 访问节点
int i = 1;
int l = ArrayBinaryTree.Left(i);
int r = ArrayBinaryTree.Right(i);
int p = ArrayBinaryTree.Parent(i);
int l = abt.Left(i);
int r = abt.Right(i);
int p = abt.Parent(i);
Console.WriteLine("\n当前节点的索引为 " + i + " ,值为 " + abt.Val(i));
Console.WriteLine("其左子节点的索引为 " + l + " ,值为 " + (abt.Val(l).HasValue ? abt.Val(l) : "null"));
Console.WriteLine("其右子节点的索引为 " + r + " ,值为 " + (abt.Val(r).HasValue ? abt.Val(r) : "null"));
Expand Down
2 changes: 1 addition & 1 deletion docs/chapter_appendix/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

### C# 环境

1. 下载并安装 [.Net 6.0](https://dotnet.microsoft.com/en-us/download)
1. 下载并安装 [.Net 8.0](https://dotnet.microsoft.com/en-us/download)
2. 在 VSCode 的插件市场中搜索 `C# Dev Kit` ,安装 C# Dev Kit ([配置教程](https://code.visualstudio.com/docs/csharp/get-started))。
3. 也可使用 Visual Studio([安装教程](https://learn.microsoft.com/zh-cn/visualstudio/install/install-visual-studio?view=vs-2022))。

Expand Down

0 comments on commit e18f1d6

Please sign in to comment.