Improve the consistency between code and comments in Kotlin (#1268)

* style(kotlin): Make code and comments consistent.

* style(kotlin): convert comment location.

* style(c): Add missing comment.

* style(kotlin): Remove redundant semicolon, parenthesis and brace

* style(kotlin): Put constants inside the function.

* style(kotlin): fix unnecessary indentation.

* style(swift): Add missing comment.

* style(kotlin): Add missing comment.

* style(kotlin): Remove redundant comment.

* style(kotlin): Add missing comment.

* Update linked_list.kt

* style(csharp,js,ts): Add missing comment.

* style(kotlin): Remove empty lines.

* Update list.cs

* Update list.js

* Update list.ts

* roll back to commit 1

* style(cs,js,ts): Add missing comment in docfile.

* style(kotlin): Use normal element swapping instead of scope functions.
This commit is contained in:
curtishd
2024-04-13 20:09:39 +08:00
committed by GitHub
parent b0d6fa0f38
commit 4d9bbe72e1
25 changed files with 74 additions and 61 deletions
@@ -69,8 +69,8 @@ class GraphAdjMat(vertices: IntArray, edges: Array<IntArray>) {
if (i < 0 || j < 0 || i >= size() || j >= size() || i == j)
throw IndexOutOfBoundsException()
// 在无向图中,邻接矩阵关于主对角线对称,即满足 (i, j) == (j, i)
adjMat[i][j] = 1;
adjMat[j][i] = 1;
adjMat[i][j] = 1
adjMat[j][i] = 1
}
/* 删除边 */
@@ -79,15 +79,15 @@ class GraphAdjMat(vertices: IntArray, edges: Array<IntArray>) {
// 索引越界与相等处理
if (i < 0 || j < 0 || i >= size() || j >= size() || i == j)
throw IndexOutOfBoundsException()
adjMat[i][j] = 0;
adjMat[j][i] = 0;
adjMat[i][j] = 0
adjMat[j][i] = 0
}
/* 打印邻接矩阵 */
fun print() {
print("顶点列表 = ")
println(vertices);
println("邻接矩阵 =");
println(vertices)
println("邻接矩阵 =")
printMatrix(adjMat)
}
}