-
-
Save amankharwal/babc371bdaee30259677ca52230392c2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def bubble_sort(array): | |
n = len(array) | |
for i in range(n): | |
for j in range(0, n-i-1): | |
if array[j] > array[j+1]: | |
array[j], array[j+1] = array[j+1], array[j] | |
array = [64, 56, 78, 34, 98, 32, 67] | |
bubble_sort(array) | |
print("Sorted array using Bubble Sort Algorithm : ") | |
for i in range(len(array)): | |
print(array[i]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment