krahets 6 months ago
parent 124c7ce24d
commit b5c65756fc

@ -2830,6 +2830,9 @@ comments: true
/* 队首出队 */ /* 队首出队 */
func (q *arrayDeque) popFirst() any { func (q *arrayDeque) popFirst() any {
num := q.peekFirst() num := q.peekFirst()
if num == nil {
return nil
}
// 队首指针向后移动一位 // 队首指针向后移动一位
q.front = q.index(q.front + 1) q.front = q.index(q.front + 1)
q.queSize-- q.queSize--
@ -2839,6 +2842,9 @@ comments: true
/* 队尾出队 */ /* 队尾出队 */
func (q *arrayDeque) popLast() any { func (q *arrayDeque) popLast() any {
num := q.peekLast() num := q.peekLast()
if num == nil {
return nil
}
q.queSize-- q.queSize--
return num return num
} }

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

@ -322,6 +322,13 @@
<br><sub>JS, TS</sub> <br><sub>JS, TS</sub>
</a> </a>
</div> </div>
<div class="profile-cell">
<a href="https://github.com/khoaxuantu">
<img class="profile-img" src="../assets/avatar/avatar_khoaxuantu.jpg" alt="Reviewer: khoaxuantu" />
<br><b>khoaxuantu</b>
<br><sub>Ruby</sub>
</a>
</div>
<div class="profile-cell"> <div class="profile-cell">
<a href="https://github.com/krahets"> <a href="https://github.com/krahets">
<img class="profile-img" src="../assets/avatar/avatar_krahets.jpg" alt="Reviewer: krahets" /> <img class="profile-img" src="../assets/avatar/avatar_krahets.jpg" alt="Reviewer: krahets" />

@ -286,6 +286,14 @@
<br><sub>Zig, Rust</sub> <br><sub>Zig, Rust</sub>
</a> </a>
</div> </div>
<div class="profile-cell">
<a href="https://github.com/curtishd">
<img class="profile-img" src="../assets/avatar/avatar_curtishd.jpg"
alt="Reviewer: curtishd" />
<br><b>curtishd</b>
<br><sub>Kotlin</sub>
</a>
</div>
<div class="profile-cell"> <div class="profile-cell">
<a href="https://github.com/Gonglja"> <a href="https://github.com/Gonglja">
<img class="profile-img" src="../assets/avatar/avatar_Gonglja.jpg" alt="Reviewer: Gonglja" /> <img class="profile-img" src="../assets/avatar/avatar_Gonglja.jpg" alt="Reviewer: Gonglja" />
@ -314,6 +322,13 @@
<br><sub>JS, TS</sub> <br><sub>JS, TS</sub>
</a> </a>
</div> </div>
<div class="profile-cell">
<a href="https://github.com/khoaxuantu">
<img class="profile-img" src="../assets/avatar/avatar_khoaxuantu.jpg" alt="Reviewer: khoaxuantu" />
<br><b>khoaxuantu</b>
<br><sub>Ruby</sub>
</a>
</div>
<div class="profile-cell"> <div class="profile-cell">
<a href="https://github.com/krahets"> <a href="https://github.com/krahets">
<img class="profile-img" src="../assets/avatar/avatar_krahets.jpg" alt="Reviewer: krahets" /> <img class="profile-img" src="../assets/avatar/avatar_krahets.jpg" alt="Reviewer: krahets" />

Loading…
Cancel
Save