mirror of
https://github.com/krahets/hello-algo.git
synced 2025-11-02 04:31:55 +08:00
feat: add ArrayDeque (#348)
* 双向队列: java 代码 * 双向队列: markdown 内容 * Rewrite array_deque.java Update array_queue.java, linkedlist_deque.java * Add ArrayDeque figures and rewrite the contents --------- Co-authored-by: krahets <krahets@163.com>
This commit is contained in:
@ -38,7 +38,7 @@ class ArrayQueue {
|
||||
// 计算尾指针,指向队尾索引 + 1
|
||||
// 通过取余操作,实现 rear 越过数组尾部后回到头部
|
||||
const rear = (this.#front + this.size) % this.capacity;
|
||||
// 尾结点后添加 num
|
||||
// 将 num 添加至队尾
|
||||
this.#nums[rear] = num;
|
||||
this.#queSize++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user