Skip to content

Commit 189b350

Browse files
yijoonsucclauss
yijoonsu
authored andcommitted
* deque add pop * deque add remove
1 parent 4617aa7 commit 189b350

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

data_structures/queue/double_ended_queue.py

+18
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,21 @@
3737
# printing modified deque
3838
print("The deque after reversing deque is : ")
3939
print(de)
40+
41+
# get right-end value and eliminate
42+
startValue = de.pop()
43+
44+
print("The deque after popping value at end is : ")
45+
print(de)
46+
47+
# get left-end value and eliminate
48+
endValue = de.popleft()
49+
50+
print("The deque after popping value at start is : ")
51+
print(de)
52+
53+
# eliminate element searched by value
54+
de.remove(5)
55+
56+
print("The deque after eliminating element searched by value : ")
57+
print(de)

0 commit comments

Comments
 (0)