mirror of
https://github.com/krahets/hello-algo.git
synced 2026-07-05 10:36:39 +08:00
translation: Update the figures for the chapter of stack and queue (#1084)
* Update the figures for the chapter of stack and queue * Bug fixes and reducing file size
This commit is contained in:
@@ -347,19 +347,19 @@ For a double-ended queue, both the head and the tail can perform enqueue and deq
|
||||
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 double-ended queue, respectively, and implement the functionality to add and remove nodes at both ends.
|
||||
|
||||
=== "LinkedListDeque"
|
||||

|
||||

|
||||
|
||||
=== "pushLast()"
|
||||

|
||||

|
||||
|
||||
=== "pushFirst()"
|
||||

|
||||

|
||||
|
||||
=== "popLast()"
|
||||

|
||||

|
||||
|
||||
=== "popFirst()"
|
||||

|
||||

|
||||
|
||||
The implementation code is as follows:
|
||||
|
||||
@@ -372,19 +372,19 @@ The implementation code is as follows:
|
||||
As shown in the figure below, similar to implementing a queue with an array, we can also use a circular array to implement a double-ended queue.
|
||||
|
||||
=== "ArrayDeque"
|
||||

|
||||

|
||||
|
||||
=== "pushLast()"
|
||||

|
||||

|
||||
|
||||
=== "pushFirst()"
|
||||

|
||||

|
||||
|
||||
=== "popLast()"
|
||||

|
||||

|
||||
|
||||
=== "popFirst()"
|
||||

|
||||

|
||||
|
||||
The implementation only needs to add methods for "front enqueue" and "rear dequeue":
|
||||
|
||||
|
||||
Reference in New Issue
Block a user