mirror of
https://github.com/krahets/hello-algo.git
synced 2025-07-07 06:44:57 +08:00
Add python code of chapter queue to docs.
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user