Polish the chapter

introduction, computational complexity.
This commit is contained in:
krahets
2023-08-20 14:51:39 +08:00
parent 5fb728b3d6
commit 2626de8d0b
87 changed files with 375 additions and 371 deletions

View File

@ -160,35 +160,35 @@ public class time_complexity {
Console.WriteLine("输入数据大小 n = " + n);
int count = constant(n);
Console.WriteLine("常数阶的计算操作数量 = " + count);
Console.WriteLine("常数阶的操作数量 = " + count);
count = linear(n);
Console.WriteLine("线性阶的计算操作数量 = " + count);
Console.WriteLine("线性阶的操作数量 = " + count);
count = arrayTraversal(new int[n]);
Console.WriteLine("线性阶(遍历数组)的计算操作数量 = " + count);
Console.WriteLine("线性阶(遍历数组)的操作数量 = " + count);
count = quadratic(n);
Console.WriteLine("平方阶的计算操作数量 = " + count);
Console.WriteLine("平方阶的操作数量 = " + count);
int[] nums = new int[n];
for (int i = 0; i < n; i++)
nums[i] = n - i; // [n,n-1,...,2,1]
count = bubbleSort(nums);
Console.WriteLine("平方阶(冒泡排序)的计算操作数量 = " + count);
Console.WriteLine("平方阶(冒泡排序)的操作数量 = " + count);
count = exponential(n);
Console.WriteLine("指数阶(循环实现)的计算操作数量 = " + count);
Console.WriteLine("指数阶(循环实现)的操作数量 = " + count);
count = expRecur(n);
Console.WriteLine("指数阶(递归实现)的计算操作数量 = " + count);
Console.WriteLine("指数阶(递归实现)的操作数量 = " + count);
count = logarithmic((float)n);
Console.WriteLine("对数阶(循环实现)的计算操作数量 = " + count);
Console.WriteLine("对数阶(循环实现)的操作数量 = " + count);
count = logRecur((float)n);
Console.WriteLine("对数阶(递归实现)的计算操作数量 = " + count);
Console.WriteLine("对数阶(递归实现)的操作数量 = " + count);
count = linearLogRecur((float)n);
Console.WriteLine("线性对数阶(递归实现)的计算操作数量 = " + count);
Console.WriteLine("线性对数阶(递归实现)的操作数量 = " + count);
count = factorialRecur(n);
Console.WriteLine("阶乘阶(递归实现)的计算操作数量 = " + count);
Console.WriteLine("阶乘阶(递归实现)的操作数量 = " + count);
}
}