This commit is contained in:
krahets
2024-05-31 17:45:16 +08:00
parent 124c7ce24d
commit b5c65756fc
4 changed files with 32 additions and 0 deletions

View File

@@ -1762,6 +1762,10 @@ comments: true
/* 出队 */
func (q *arrayQueue) pop() any {
num := q.peek()
if num == nil {
return nil
}
// 队首指针向后移动一位,若越过尾部,则返回到数组头部
q.front = (q.front + 1) % q.queCapacity
q.queSize--