mirror of
https://github.com/krahets/hello-algo.git
synced 2026-07-07 05:04:20 +00:00
Add animation player (#1877)
* Add auto slide controller. * Fix the animation blocks. * renamed as animation_player * Bug fixes * Refine animation player controls
This commit is contained in:
@@ -399,19 +399,19 @@ For a deque, both the front and rear can perform enqueue and dequeue operations.
|
||||
|
||||
As shown in the figure below, we treat the head and tail nodes of the doubly linked list as the front and rear of the deque, implementing functionality to add and remove nodes at both ends.
|
||||
|
||||
=== "LinkedListDeque"
|
||||
=== "<1>"
|
||||

|
||||
|
||||
=== "push_last()"
|
||||
=== "<2>"
|
||||

|
||||
|
||||
=== "push_first()"
|
||||
=== "<3>"
|
||||

|
||||
|
||||
=== "pop_last()"
|
||||
=== "<4>"
|
||||

|
||||
|
||||
=== "pop_first()"
|
||||
=== "<5>"
|
||||

|
||||
|
||||
The implementation code is shown below:
|
||||
@@ -424,19 +424,19 @@ The implementation code is shown below:
|
||||
|
||||
As shown in the figure below, similar to implementing a queue based on an array, we can also use a circular array to implement a deque.
|
||||
|
||||
=== "ArrayDeque"
|
||||
=== "<1>"
|
||||

|
||||
|
||||
=== "push_last()"
|
||||
=== "<2>"
|
||||

|
||||
|
||||
=== "push_first()"
|
||||
=== "<3>"
|
||||

|
||||
|
||||
=== "pop_last()"
|
||||
=== "<4>"
|
||||

|
||||
|
||||
=== "pop_first()"
|
||||
=== "<5>"
|
||||

|
||||
|
||||
Based on the queue implementation, we only need to add methods for "enqueue at front" and "dequeue from rear":
|
||||
|
||||
Reference in New Issue
Block a user