Skip to content

Commit

Permalink
Update binary_search_insertion.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
krahets authored Nov 26, 2023
1 parent 6a73462 commit 3c66a5f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions codes/csharp/chapter_searching/binary_search_insertion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace hello_algo.chapter_searching;

public class binary_search_insertion {
/* 二分查找插入点(无重复元素) */
public static int BinarySearchInsertionSimple(int[] nums, int target) {
public int BinarySearchInsertionSimple(int[] nums, int target) {
int i = 0, j = nums.Length - 1; // 初始化双闭区间 [0, n-1]
while (i <= j) {
int m = i + (j - i) / 2; // 计算中点索引 m
Expand All @@ -25,7 +25,7 @@ public static int BinarySearchInsertionSimple(int[] nums, int target) {
}

/* 二分查找插入点(存在重复元素) */
public static int BinarySearchInsertion(int[] nums, int target) {
public int BinarySearchInsertion(int[] nums, int target) {
int i = 0, j = nums.Length - 1; // 初始化双闭区间 [0, n-1]
while (i <= j) {
int m = i + (j - i) / 2; // 计算中点索引 m
Expand Down

0 comments on commit 3c66a5f

Please sign in to comment.