Add python code of chapter queue to docs.

This commit is contained in:
Yudong Jin
2022-12-02 00:09:34 +08:00
parent 460d42ae3d
commit e20bc251f5
18 changed files with 276 additions and 134 deletions

View File

@ -50,11 +50,8 @@ class ArrayQueue {
/* 出队 */
public int poll() {
// 删除头结点
if (isEmpty())
throw new EmptyStackException();
int num = nums[front];
// 队头指针向后移动,越过尾部后返回到数组头部
int num = peek();
// 队头指针向后移动一位,若越过尾部则返回到数组头部
front = (front + 1) % capacity();
return num;
}