This commit is contained in:
krahets
2024-06-13 15:44:53 +08:00
parent b5c65756fc
commit f9d935e34c
6 changed files with 94 additions and 51 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--