mirror of
https://github.com/krahets/hello-algo.git
synced 2025-07-25 11:13:38 +08:00
build
This commit is contained in:
@ -332,13 +332,13 @@ To implement a queue, we need a data structure that allows adding elements at on
|
||||
As shown in the Figure 5-5 , we can consider the "head node" and "tail node" of a linked list as the "head" and "tail" of the queue, respectively. We restrict the operations so that nodes can only be added at the tail and removed at the head.
|
||||
|
||||
=== "LinkedListQueue"
|
||||
{ class="animation-figure" }
|
||||
{ class="animation-figure" }
|
||||
|
||||
=== "push()"
|
||||
{ class="animation-figure" }
|
||||
{ class="animation-figure" }
|
||||
|
||||
=== "pop()"
|
||||
{ class="animation-figure" }
|
||||
{ class="animation-figure" }
|
||||
|
||||
<p align="center"> Figure 5-5 Implementing Queue with Linked List for Enqueue and Dequeue Operations </p>
|
||||
|
||||
@ -1231,13 +1231,13 @@ With this design, **the effective interval of elements in the array is `[front,
|
||||
Both enqueue and dequeue operations only require a single operation, each with a time complexity of $O(1)$.
|
||||
|
||||
=== "ArrayQueue"
|
||||
{ class="animation-figure" }
|
||||
{ class="animation-figure" }
|
||||
|
||||
=== "push()"
|
||||
{ class="animation-figure" }
|
||||
{ class="animation-figure" }
|
||||
|
||||
=== "pop()"
|
||||
{ class="animation-figure" }
|
||||
{ class="animation-figure" }
|
||||
|
||||
<p align="center"> Figure 5-6 Implementing Queue with Array for Enqueue and Dequeue Operations </p>
|
||||
|
||||
|
Reference in New Issue
Block a user