mirror of
https://github.com/krahets/hello-algo.git
synced 2025-07-06 22:34:18 +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:
@ -43,7 +43,7 @@ class ArrayQueue {
|
||||
// 计算尾指针,指向队尾索引 + 1
|
||||
// 通过取余操作,实现 rear 越过数组尾部后回到头部
|
||||
int rear = (front + queSize) % capacity();
|
||||
// 尾结点后添加 num
|
||||
// 将 num 添加至队尾
|
||||
nums[rear] = num;
|
||||
queSize++;
|
||||
}
|
||||
|
Reference in New Issue
Block a user