mirror of
https://github.com/autistic-symposium/master-algorithms-py.git
synced 2025-04-30 04:36:08 -04:00
Update README.md
This commit is contained in:
parent
621f32f4aa
commit
132a5700c4
@ -2,6 +2,19 @@
|
|||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
|
### queues
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
* queues can be implemented with two arrays or a dynamic array (linked list).
|
||||||
|
* if implemented with a dynamic array, a more efficient solution is to use a circular queue (ring buffer), i.e. a fixed-size array and two pointers to indicate the starting and ending positions.
|
||||||
|
* an advantage of circular queues is that we can use the spaces in front of the queue. in a normal queue, once the queue becomes full, we cannot insert the next element even if there is a space in front of the queue. but using the circular queue, we can use the space to store new values.
|
||||||
|
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
### `Queues.py`
|
### `Queues.py`
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
@ -56,4 +69,4 @@ Popping...
|
|||||||
17
|
17
|
||||||
16
|
16
|
||||||
Stack: [12, 13, 14, 15]
|
Stack: [12, 13, 14, 15]
|
||||||
```
|
```
|
||||||
|
Loading…
x
Reference in New Issue
Block a user