From 189b35031224e78e10b668e19fc4b2a1966d19c1 Mon Sep 17 00:00:00 2001 From: yijoonsu <44707391+paulo9428@users.noreply.github.com> Date: Mon, 30 Sep 2019 23:27:41 +0900 Subject: [PATCH] Deque (#1200) * deque add pop * deque add remove --- data_structures/queue/double_ended_queue.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/data_structures/queue/double_ended_queue.py b/data_structures/queue/double_ended_queue.py index a2fc8f66e..a3cfa7230 100644 --- a/data_structures/queue/double_ended_queue.py +++ b/data_structures/queue/double_ended_queue.py @@ -37,3 +37,21 @@ de.reverse() # 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 value at end is : ") +print(de) + +# get left-end value and eliminate +endValue = de.popleft() + +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)