feat(csharp) .NET 8.0 code migration (#966)

* .net 8.0 migration

* update docs

* revert change

* revert change and update appendix docs

* remove static

* Update binary_search_insertion.cs

* Update binary_search_insertion.cs

* Update binary_search_edge.cs

* Update binary_search_insertion.cs

* Update binary_search_edge.cs

---------

Co-authored-by: Yudong Jin <krahets@163.com>
This commit is contained in:
hpstory
2023-11-26 23:18:44 +08:00
committed by GitHub
parent d960c99a1f
commit 56b20eff36
93 changed files with 539 additions and 487 deletions
@@ -8,7 +8,7 @@ namespace hello_algo.chapter_divide_and_conquer;
public class binary_search_recur {
/* 二分查找:问题 f(i, j) */
public int DFS(int[] nums, int target, int i, int j) {
int DFS(int[] nums, int target, int i, int j) {
// 若区间为空,代表无目标元素,则返回 -1
if (i > j) {
return -1;
@@ -28,7 +28,7 @@ public class binary_search_recur {
}
/* 二分查找 */
public int BinarySearch(int[] nums, int target) {
int BinarySearch(int[] nums, int target) {
int n = nums.Length;
// 求解问题 f(0, n-1)
return DFS(nums, target, 0, n - 1);
@@ -37,7 +37,7 @@ public class binary_search_recur {
[Test]
public void Test() {
int target = 6;
int[] nums = { 1, 3, 6, 8, 12, 15, 23, 26, 31, 35 };
int[] nums = [1, 3, 6, 8, 12, 15, 23, 26, 31, 35];
// 二分查找(双闭区间)
int index = BinarySearch(nums, target);