From 6715a227e74be1009f29572e10e79ea8bfefc661 Mon Sep 17 00:00:00 2001 From: Sarah Luiz Date: Tue, 22 Oct 2019 23:22:17 -0300 Subject: [PATCH] Add BubbleSort in Python --- Python/BubbleSort.py | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 Python/BubbleSort.py diff --git a/Python/BubbleSort.py b/Python/BubbleSort.py new file mode 100644 index 0000000..cc51d46 --- /dev/null +++ b/Python/BubbleSort.py @@ -0,0 +1,7 @@ +def BubbleSort(arr): + n = len(arr) + + for i in range(n): + for j in range(i+1, n): + if arr[i] > arr[j]: + arr[i], arr[j] = arr[j], arr[i] \ No newline at end of file