-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/Deque' into main
- Loading branch information
Showing
12 changed files
with
1,116 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Deque | ||
|
||
A double-ended queue, often abbreviated as "deque" (pronounced as "deck"), is a linear data structure that allows elements to be added or removed from both ends efficiently. It is an extension of a queue and a stack, providing operations for adding and removing elements from the front and back. Deques can be implemented using arrays or linked lists, and they are useful in scenarios where you need to perform insertions and deletions at both ends of the data structure. | ||
|
||
## Advantages | ||
* Efficient Operations: Deques allow constant-time (O(1)) insertion and removal of elements at both ends, making them suitable for various algorithms and data manipulation tasks. | ||
* Versatility: Deques can serve as both a queue and a stack, providing flexibility in implementing various data structures and algorithms. | ||
* Fast Access: Deques provide fast access to both the front and rear elements, enabling efficient traversal and search operations. | ||
|
||
## Disadvantages | ||
* Memory Overhead: Depending on the implementation, deques may require additional memory compared to simpler data structures like arrays or linked lists. | ||
* Complexity: Implementing and maintaining a deque can be more complex than using a simple stack or queue, especially when dealing with dynamic resizing. | ||
|
||
# Code | ||
```csharp file=../../src/Extended.Collections.Playground/Generic/DequeSandbox.cs#L2- | ||
// Imported | ||
``` | ||
|
||
```mermaid | ||
graph TD; | ||
A-->B; | ||
A-->C; | ||
B-->D; | ||
C-->D; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.