From 23fe2de05a168468afbd55b2271ed4eaf90da6d5 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Mon, 30 Sep 2019 10:00:49 +0200 Subject: [PATCH 1/3] Delete double_ended_queue.py Fixes #1200 As discussed on #1200 this file does not contain an algorithm as it does not implement a double ended queue but instead just uses the standard library's DEQ. @paulo9428 @cozek, @AnupKumarPanwar Your reviews please. --- data_structures/queue/double_ended_queue.py | 39 --------------------- 1 file changed, 39 deletions(-) delete mode 100644 data_structures/queue/double_ended_queue.py diff --git a/data_structures/queue/double_ended_queue.py b/data_structures/queue/double_ended_queue.py deleted file mode 100644 index a2fc8f66ec22..000000000000 --- a/data_structures/queue/double_ended_queue.py +++ /dev/null @@ -1,39 +0,0 @@ -# Python code to demonstrate working of -# extend(), extendleft(), rotate(), reverse() - -# importing "collections" for deque operations -import collections - -# initializing deque -de = collections.deque([1, 2, 3,]) - -# using extend() to add numbers to right end -# adds 4,5,6 to right end -de.extend([4,5,6]) - -# printing modified deque -print("The deque after extending deque at end is : ") -print(de) - -# using extendleft() to add numbers to left end -# adds 7,8,9 to right end -de.extendleft([7,8,9]) - -# printing modified deque -print("The deque after extending deque at beginning is : ") -print(de) - -# using rotate() to rotate the deque -# rotates by 3 to left -de.rotate(-3) - -# printing modified deque -print("The deque after rotating deque is : ") -print(de) - -# using reverse() to reverse the deque -de.reverse() - -# printing modified deque -print("The deque after reversing deque is : ") -print(de) From 7c9ed9acf9691cbafa0c1ee97ba910dbd260b620 Mon Sep 17 00:00:00 2001 From: cclauss Date: Thu, 3 Oct 2019 13:28:18 +0200 Subject: [PATCH 2/3] fixup: add the file --- data_structures/queue/double_ended_queue.py | 57 +++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 data_structures/queue/double_ended_queue.py diff --git a/data_structures/queue/double_ended_queue.py b/data_structures/queue/double_ended_queue.py new file mode 100644 index 000000000000..a3cfa7230710 --- /dev/null +++ b/data_structures/queue/double_ended_queue.py @@ -0,0 +1,57 @@ +# Python code to demonstrate working of +# extend(), extendleft(), rotate(), reverse() + +# importing "collections" for deque operations +import collections + +# initializing deque +de = collections.deque([1, 2, 3,]) + +# using extend() to add numbers to right end +# adds 4,5,6 to right end +de.extend([4,5,6]) + +# printing modified deque +print("The deque after extending deque at end is : ") +print(de) + +# using extendleft() to add numbers to left end +# adds 7,8,9 to right end +de.extendleft([7,8,9]) + +# printing modified deque +print("The deque after extending deque at beginning is : ") +print(de) + +# using rotate() to rotate the deque +# rotates by 3 to left +de.rotate(-3) + +# printing modified deque +print("The deque after rotating deque is : ") +print(de) + +# using reverse() to reverse the deque +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) From a5b616d36af18dbbec81c1ba128b77f0e1a7dfa3 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Thu, 3 Oct 2019 11:33:41 +0000 Subject: [PATCH 3/3] Delete double_ended_queue.py --- data_structures/queue/double_ended_queue.py | 57 --------------------- 1 file changed, 57 deletions(-) delete mode 100644 data_structures/queue/double_ended_queue.py diff --git a/data_structures/queue/double_ended_queue.py b/data_structures/queue/double_ended_queue.py deleted file mode 100644 index a3cfa7230710..000000000000 --- a/data_structures/queue/double_ended_queue.py +++ /dev/null @@ -1,57 +0,0 @@ -# Python code to demonstrate working of -# extend(), extendleft(), rotate(), reverse() - -# importing "collections" for deque operations -import collections - -# initializing deque -de = collections.deque([1, 2, 3,]) - -# using extend() to add numbers to right end -# adds 4,5,6 to right end -de.extend([4,5,6]) - -# printing modified deque -print("The deque after extending deque at end is : ") -print(de) - -# using extendleft() to add numbers to left end -# adds 7,8,9 to right end -de.extendleft([7,8,9]) - -# printing modified deque -print("The deque after extending deque at beginning is : ") -print(de) - -# using rotate() to rotate the deque -# rotates by 3 to left -de.rotate(-3) - -# printing modified deque -print("The deque after rotating deque is : ") -print(de) - -# using reverse() to reverse the deque -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)