mirror of
https://github.com/krahets/hello-algo.git
synced 2025-11-02 12:58:42 +08:00
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:
@ -8,18 +8,18 @@ namespace hello_algo.chapter_stack_and_queue;
|
||||
|
||||
/* 基于环形数组实现的双向队列 */
|
||||
public class ArrayDeque {
|
||||
private readonly int[] nums; // 用于存储双向队列元素的数组
|
||||
private int front; // 队首指针,指向队首元素
|
||||
private int queSize; // 双向队列长度
|
||||
int[] nums; // 用于存储双向队列元素的数组
|
||||
int front; // 队首指针,指向队首元素
|
||||
int queSize; // 双向队列长度
|
||||
|
||||
/* 构造方法 */
|
||||
public ArrayDeque(int capacity) {
|
||||
this.nums = new int[capacity];
|
||||
nums = new int[capacity];
|
||||
front = queSize = 0;
|
||||
}
|
||||
|
||||
/* 获取双向队列的容量 */
|
||||
public int Capacity() {
|
||||
int Capacity() {
|
||||
return nums.Length;
|
||||
}
|
||||
|
||||
@ -34,7 +34,7 @@ public class ArrayDeque {
|
||||
}
|
||||
|
||||
/* 计算环形数组索引 */
|
||||
private int Index(int i) {
|
||||
int Index(int i) {
|
||||
// 通过取余操作实现数组首尾相连
|
||||
// 当 i 越过数组尾部后,回到头部
|
||||
// 当 i 越过数组头部后,回到尾部
|
||||
|
||||
Reference in New Issue
Block a user