feat(queue): introduce a queue ds, internally this is just a stack...
the only actual difference is a oneline change which makes pushing append instead of prepend the new data.
This commit is contained in:
parent
9daffd4ed1
commit
758edf9d30
4 changed files with 93 additions and 1 deletions
|
|
@ -45,7 +45,7 @@ ds_hmp_free(&hmp, NULL);
|
|||
free(b);
|
||||
```
|
||||
|
||||
## Stack
|
||||
## Stack / Queue
|
||||
```c
|
||||
char *a = "a";
|
||||
char *b = "b";
|
||||
|
|
@ -58,6 +58,9 @@ ds_stack_pop(stack); // "b"
|
|||
ds_stack_pop(stack); // "a"
|
||||
free(stack);
|
||||
```
|
||||
If you need a queue just use the equivalent `ds_queue` functions and datatypes.
|
||||
Internally a queue is just a stack which pushes to the end instead of the
|
||||
beginning.
|
||||
|
||||
# TODO
|
||||
- [ ] more data structures
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue