refactor: Replace poll with pop in Queue and Deque (#415)

This commit is contained in:
Yudong Jin
2023-03-13 21:58:21 +08:00
committed by GitHub
parent 2d17ee8e92
commit 8aebbaad21
77 changed files with 261 additions and 261 deletions

View File

@@ -112,11 +112,11 @@ func TestLinkedListDeque(t *testing.T) {
fmt.Println("队尾元素 rear =", rear)
// 元素出队
pollFirst := deque.pollFirst()
fmt.Print("队首出队元素 pollFirst = ", pollFirst, ",队首出队后 deque = ")
popFirst := deque.popFirst()
fmt.Print("队首出队元素 popFirst = ", popFirst, ",队首出队后 deque = ")
PrintList(deque.toList())
pollLast := deque.pollLast()
fmt.Print("队尾出队元素 pollLast = ", pollLast, ",队尾出队后 deque = ")
popLast := deque.popLast()
fmt.Print("队尾出队元素 popLast = ", popLast, ",队尾出队后 deque = ")
PrintList(deque.toList())
// 获取队的长度
@@ -136,6 +136,6 @@ func BenchmarkLinkedListDeque(b *testing.B) {
deque.pushLast(777)
}
for i := 0; i < b.N; i++ {
deque.pollFirst()
deque.popFirst()
}
}