mirror of
https://github.com/krahets/hello-algo.git
synced 2026-03-25 22:32:08 +08:00
fix(csharp): Modify method name to PascalCase, simplify new expression (#840)
* Modify method name to PascalCase(array and linked list) * Modify method name to PascalCase(backtracking) * Modify method name to PascalCase(computational complexity) * Modify method name to PascalCase(divide and conquer) * Modify method name to PascalCase(dynamic programming) * Modify method name to PascalCase(graph) * Modify method name to PascalCase(greedy) * Modify method name to PascalCase(hashing) * Modify method name to PascalCase(heap) * Modify method name to PascalCase(searching) * Modify method name to PascalCase(sorting) * Modify method name to PascalCase(stack and queue) * Modify method name to PascalCase(tree) * local check
This commit is contained in:
@@ -33,7 +33,7 @@
|
||||
=== "C#"
|
||||
|
||||
```csharp title="iteration.cs"
|
||||
[class]{iteration}-[func]{forLoop}
|
||||
[class]{iteration}-[func]{ForLoop}
|
||||
```
|
||||
|
||||
=== "Go"
|
||||
@@ -117,7 +117,7 @@
|
||||
=== "C#"
|
||||
|
||||
```csharp title="iteration.cs"
|
||||
[class]{iteration}-[func]{whileLoop}
|
||||
[class]{iteration}-[func]{WhileLoop}
|
||||
```
|
||||
|
||||
=== "Go"
|
||||
@@ -193,7 +193,7 @@
|
||||
=== "C#"
|
||||
|
||||
```csharp title="iteration.cs"
|
||||
[class]{iteration}-[func]{whileLoopII}
|
||||
[class]{iteration}-[func]{WhileLoopII}
|
||||
```
|
||||
|
||||
=== "Go"
|
||||
@@ -271,7 +271,7 @@
|
||||
=== "C#"
|
||||
|
||||
```csharp title="iteration.cs"
|
||||
[class]{iteration}-[func]{nestedForLoop}
|
||||
[class]{iteration}-[func]{NestedForLoop}
|
||||
```
|
||||
|
||||
=== "Go"
|
||||
@@ -366,7 +366,7 @@
|
||||
=== "C#"
|
||||
|
||||
```csharp title="recursion.cs"
|
||||
[class]{recursion}-[func]{recur}
|
||||
[class]{recursion}-[func]{Recur}
|
||||
```
|
||||
|
||||
=== "Go"
|
||||
@@ -474,7 +474,7 @@
|
||||
=== "C#"
|
||||
|
||||
```csharp title="recursion.cs"
|
||||
[class]{recursion}-[func]{tailRecur}
|
||||
[class]{recursion}-[func]{TailRecur}
|
||||
```
|
||||
|
||||
=== "Go"
|
||||
@@ -572,7 +572,7 @@
|
||||
=== "C#"
|
||||
|
||||
```csharp title="recursion.cs"
|
||||
[class]{recursion}-[func]{fib}
|
||||
[class]{recursion}-[func]{Fib}
|
||||
```
|
||||
|
||||
=== "Go"
|
||||
@@ -679,7 +679,7 @@
|
||||
=== "C#"
|
||||
|
||||
```csharp title="recursion.cs"
|
||||
[class]{recursion}-[func]{forLoopRecur}
|
||||
[class]{recursion}-[func]{ForLoopRecur}
|
||||
```
|
||||
|
||||
=== "Go"
|
||||
|
||||
@@ -105,16 +105,16 @@
|
||||
}
|
||||
|
||||
/* 函数 */
|
||||
int function() {
|
||||
int Function() {
|
||||
// 执行某些操作...
|
||||
return 0;
|
||||
}
|
||||
|
||||
int algorithm(int n) { // 输入数据
|
||||
int Algorithm(int n) { // 输入数据
|
||||
const int a = 0; // 暂存数据(常量)
|
||||
int b = 0; // 暂存数据(变量)
|
||||
Node node = new Node(0); // 暂存数据(对象)
|
||||
int c = function(); // 栈帧空间(调用函数)
|
||||
Node node = new(0); // 暂存数据(对象)
|
||||
int c = Function(); // 栈帧空间(调用函数)
|
||||
return a + b + c; // 输出数据
|
||||
}
|
||||
```
|
||||
@@ -360,7 +360,7 @@
|
||||
=== "C#"
|
||||
|
||||
```csharp title=""
|
||||
void algorithm(int n) {
|
||||
void Algorithm(int n) {
|
||||
int a = 0; // O(1)
|
||||
int[] b = new int[10000]; // O(1)
|
||||
if (n > 10) {
|
||||
@@ -526,20 +526,20 @@
|
||||
=== "C#"
|
||||
|
||||
```csharp title=""
|
||||
int function() {
|
||||
int Function() {
|
||||
// 执行某些操作
|
||||
return 0;
|
||||
}
|
||||
/* 循环 O(1) */
|
||||
void loop(int n) {
|
||||
void Loop(int n) {
|
||||
for (int i = 0; i < n; i++) {
|
||||
function();
|
||||
Function();
|
||||
}
|
||||
}
|
||||
/* 递归 O(n) */
|
||||
int recur(int n) {
|
||||
int Recur(int n) {
|
||||
if (n == 1) return 1;
|
||||
return recur(n - 1);
|
||||
return Recur(n - 1);
|
||||
}
|
||||
```
|
||||
|
||||
@@ -746,9 +746,9 @@ $$
|
||||
=== "C#"
|
||||
|
||||
```csharp title="space_complexity.cs"
|
||||
[class]{space_complexity}-[func]{function}
|
||||
[class]{space_complexity}-[func]{Function}
|
||||
|
||||
[class]{space_complexity}-[func]{constant}
|
||||
[class]{space_complexity}-[func]{Constant}
|
||||
```
|
||||
|
||||
=== "Go"
|
||||
@@ -840,7 +840,7 @@ $$
|
||||
=== "C#"
|
||||
|
||||
```csharp title="space_complexity.cs"
|
||||
[class]{space_complexity}-[func]{linear}
|
||||
[class]{space_complexity}-[func]{Linear}
|
||||
```
|
||||
|
||||
=== "Go"
|
||||
@@ -916,7 +916,7 @@ $$
|
||||
=== "C#"
|
||||
|
||||
```csharp title="space_complexity.cs"
|
||||
[class]{space_complexity}-[func]{linearRecur}
|
||||
[class]{space_complexity}-[func]{LinearRecur}
|
||||
```
|
||||
|
||||
=== "Go"
|
||||
@@ -994,7 +994,7 @@ $$
|
||||
=== "C#"
|
||||
|
||||
```csharp title="space_complexity.cs"
|
||||
[class]{space_complexity}-[func]{quadratic}
|
||||
[class]{space_complexity}-[func]{Quadratic}
|
||||
```
|
||||
|
||||
=== "Go"
|
||||
@@ -1068,7 +1068,7 @@ $$
|
||||
=== "C#"
|
||||
|
||||
```csharp title="space_complexity.cs"
|
||||
[class]{space_complexity}-[func]{quadraticRecur}
|
||||
[class]{space_complexity}-[func]{QuadraticRecur}
|
||||
```
|
||||
|
||||
=== "Go"
|
||||
@@ -1146,7 +1146,7 @@ $$
|
||||
=== "C#"
|
||||
|
||||
```csharp title="space_complexity.cs"
|
||||
[class]{space_complexity}-[func]{buildTree}
|
||||
[class]{space_complexity}-[func]{BuildTree}
|
||||
```
|
||||
|
||||
=== "Go"
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
|
||||
```csharp title=""
|
||||
// 在某运行平台下
|
||||
void algorithm(int n) {
|
||||
void Algorithm(int n) {
|
||||
int a = 2; // 1 ns
|
||||
a = a + 1; // 1 ns
|
||||
a = a * 2; // 10 ns
|
||||
@@ -253,17 +253,17 @@ $$
|
||||
|
||||
```csharp title=""
|
||||
// 算法 A 的时间复杂度:常数阶
|
||||
void algorithm_A(int n) {
|
||||
void AlgorithmA(int n) {
|
||||
Console.WriteLine(0);
|
||||
}
|
||||
// 算法 B 的时间复杂度:线性阶
|
||||
void algorithm_B(int n) {
|
||||
void AlgorithmB(int n) {
|
||||
for (int i = 0; i < n; i++) {
|
||||
Console.WriteLine(0);
|
||||
}
|
||||
}
|
||||
// 算法 C 的时间复杂度:常数阶
|
||||
void algorithm_C(int n) {
|
||||
void AlgorithmC(int n) {
|
||||
for (int i = 0; i < 1000000; i++) {
|
||||
Console.WriteLine(0);
|
||||
}
|
||||
@@ -487,7 +487,7 @@ $$
|
||||
=== "C#"
|
||||
|
||||
```csharp title=""
|
||||
void algorithm(int n) {
|
||||
void Algorithm(int n) {
|
||||
int a = 1; // +1
|
||||
a = a + 1; // +1
|
||||
a = a * 2; // +1
|
||||
@@ -695,7 +695,7 @@ $T(n)$ 是一次函数,说明其运行时间的增长趋势是线性的,因
|
||||
=== "C#"
|
||||
|
||||
```csharp title=""
|
||||
void algorithm(int n) {
|
||||
void Algorithm(int n) {
|
||||
int a = 1; // +0(技巧 1)
|
||||
a = a + n; // +0(技巧 1)
|
||||
// +n(技巧 2)
|
||||
@@ -918,7 +918,7 @@ $$
|
||||
=== "C#"
|
||||
|
||||
```csharp title="time_complexity.cs"
|
||||
[class]{time_complexity}-[func]{constant}
|
||||
[class]{time_complexity}-[func]{Constant}
|
||||
```
|
||||
|
||||
=== "Go"
|
||||
@@ -994,7 +994,7 @@ $$
|
||||
=== "C#"
|
||||
|
||||
```csharp title="time_complexity.cs"
|
||||
[class]{time_complexity}-[func]{linear}
|
||||
[class]{time_complexity}-[func]{Linear}
|
||||
```
|
||||
|
||||
=== "Go"
|
||||
@@ -1068,7 +1068,7 @@ $$
|
||||
=== "C#"
|
||||
|
||||
```csharp title="time_complexity.cs"
|
||||
[class]{time_complexity}-[func]{arrayTraversal}
|
||||
[class]{time_complexity}-[func]{ArrayTraversal}
|
||||
```
|
||||
|
||||
=== "Go"
|
||||
@@ -1146,7 +1146,7 @@ $$
|
||||
=== "C#"
|
||||
|
||||
```csharp title="time_complexity.cs"
|
||||
[class]{time_complexity}-[func]{quadratic}
|
||||
[class]{time_complexity}-[func]{Quadratic}
|
||||
```
|
||||
|
||||
=== "Go"
|
||||
@@ -1224,7 +1224,7 @@ $$
|
||||
=== "C#"
|
||||
|
||||
```csharp title="time_complexity.cs"
|
||||
[class]{time_complexity}-[func]{bubbleSort}
|
||||
[class]{time_complexity}-[func]{BubbleSort}
|
||||
```
|
||||
|
||||
=== "Go"
|
||||
@@ -1302,7 +1302,7 @@ $$
|
||||
=== "C#"
|
||||
|
||||
```csharp title="time_complexity.cs"
|
||||
[class]{time_complexity}-[func]{exponential}
|
||||
[class]{time_complexity}-[func]{Exponential}
|
||||
```
|
||||
|
||||
=== "Go"
|
||||
@@ -1378,7 +1378,7 @@ $$
|
||||
=== "C#"
|
||||
|
||||
```csharp title="time_complexity.cs"
|
||||
[class]{time_complexity}-[func]{expRecur}
|
||||
[class]{time_complexity}-[func]{ExpRecur}
|
||||
```
|
||||
|
||||
=== "Go"
|
||||
@@ -1458,7 +1458,7 @@ $$
|
||||
=== "C#"
|
||||
|
||||
```csharp title="time_complexity.cs"
|
||||
[class]{time_complexity}-[func]{logarithmic}
|
||||
[class]{time_complexity}-[func]{Logarithmic}
|
||||
```
|
||||
|
||||
=== "Go"
|
||||
@@ -1534,7 +1534,7 @@ $$
|
||||
=== "C#"
|
||||
|
||||
```csharp title="time_complexity.cs"
|
||||
[class]{time_complexity}-[func]{logRecur}
|
||||
[class]{time_complexity}-[func]{LogRecur}
|
||||
```
|
||||
|
||||
=== "Go"
|
||||
@@ -1622,7 +1622,7 @@ $$
|
||||
=== "C#"
|
||||
|
||||
```csharp title="time_complexity.cs"
|
||||
[class]{time_complexity}-[func]{linearLogRecur}
|
||||
[class]{time_complexity}-[func]{LinearLogRecur}
|
||||
```
|
||||
|
||||
=== "Go"
|
||||
@@ -1710,7 +1710,7 @@ $$
|
||||
=== "C#"
|
||||
|
||||
```csharp title="time_complexity.cs"
|
||||
[class]{time_complexity}-[func]{factorialRecur}
|
||||
[class]{time_complexity}-[func]{FactorialRecur}
|
||||
```
|
||||
|
||||
=== "Go"
|
||||
@@ -1801,9 +1801,9 @@ $$
|
||||
=== "C#"
|
||||
|
||||
```csharp title="worst_best_time_complexity.cs"
|
||||
[class]{worst_best_time_complexity}-[func]{randomNumbers}
|
||||
[class]{worst_best_time_complexity}-[func]{RandomNumbers}
|
||||
|
||||
[class]{worst_best_time_complexity}-[func]{findOne}
|
||||
[class]{worst_best_time_complexity}-[func]{FindOne}
|
||||
```
|
||||
|
||||
=== "Go"
|
||||
|
||||
Reference in New Issue
Block a user