diff options
author | Tucker Evans <tucker@tuckerevans.com> | 2020-06-08 22:25:24 -0400 |
---|---|---|
committer | Tucker Evans <tucker@tuckerevans.com> | 2020-06-08 22:25:24 -0400 |
commit | f4ce6540cfaf754ab4f0a6d4b8ed6b38c0cbe956 (patch) | |
tree | b46755efd625ef1f3932794bf1f663037ead273e /collections/double_ended_queue.c | |
parent | 7e3a4d7bd009df8975f5ef374f979da7405fd501 (diff) |
Add double ended queue swap remove front/back functions.
Diffstat (limited to 'collections/double_ended_queue.c')
-rw-r--r-- | collections/double_ended_queue.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/collections/double_ended_queue.c b/collections/double_ended_queue.c index a8daf92..169693d 100644 --- a/collections/double_ended_queue.c +++ b/collections/double_ended_queue.c @@ -184,6 +184,22 @@ deq *root; return root->base[root->end]; } +void* deq_swap_rm_front(root, index) +deq *root; +int index; +{ + deq_swap(root, 0, index); + return deq_pop_front(root); +} + +void* deq_swap_rm_back(root, index) +deq *root; +int index; +{ + deq_swap(root,deq_size(root) - 1,index); + return deq_pop_back(root); +} + void deq_remove(root, index) deq *root; int index; |