From 4e6e2c617acab2d6be6f05900d0812f7c2d1cc2a Mon Sep 17 00:00:00 2001 From: paulo9428 Date: Wed, 25 Sep 2019 09:53:15 +0900 Subject: [PATCH 1/2] deque add pop --- data_structures/queue/double_ended_queue.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/data_structures/queue/double_ended_queue.py b/data_structures/queue/double_ended_queue.py index a2fc8f66ec22..a7879eb4d3e7 100644 --- a/data_structures/queue/double_ended_queue.py +++ b/data_structures/queue/double_ended_queue.py @@ -37,3 +37,15 @@ # printing modified deque print("The deque after reversing deque is : ") print(de) + +# get right-end value and eliminate +startValue = de.pop() + +print("The deque after popping deque at end is : ") +print(de) + +# get left-end value and eliminate +endValue = de.popleft() + +print("The deque after popping deque at start is : ") +print(de) From 433e1c0d306e5751518355a9586e9cb93acc5dd9 Mon Sep 17 00:00:00 2001 From: paulo9428 Date: Wed, 25 Sep 2019 09:59:15 +0900 Subject: [PATCH 2/2] deque add remove --- data_structures/queue/double_ended_queue.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/data_structures/queue/double_ended_queue.py b/data_structures/queue/double_ended_queue.py index a7879eb4d3e7..a3cfa7230710 100644 --- a/data_structures/queue/double_ended_queue.py +++ b/data_structures/queue/double_ended_queue.py @@ -41,11 +41,17 @@ # get right-end value and eliminate startValue = de.pop() -print("The deque after popping deque at end is : ") +print("The deque after popping value at end is : ") print(de) # get left-end value and eliminate endValue = de.popleft() -print("The deque after popping deque at start is : ") +print("The deque after popping value at start is : ") +print(de) + +# eliminate element searched by value +de.remove(5) + +print("The deque after eliminating element searched by value : ") print(de)