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
@@ -2830,6 +2830,9 @@ comments: true
/* 佇列首出列 */
func (q *arrayDeque) popFirst() any {
num := q.peekFirst()
if num == nil {
return nil
}
// 佇列首指標向後移動一位
q.front = q.index(q.front + 1)
q.queSize--
@@ -2839,6 +2842,9 @@ comments: true
/* 佇列尾出列 */
func (q *arrayDeque) popLast() any {
num := q.peekLast()
if num == nil {
return nil
}
q.queSize--
return num
}