Write program for Bubble Sort ?



Write program for Bubble Sort ?..

Answer / Samir Kumar Singh

Here is a simple implementation of bubble sort in Python:n```ndef bubble_sort(arr):n n = len(arr)n for i in range(n-1):n for j in range(0, n-i-1):n if arr[j] > arr[j+1]:n arr[j], arr[j+1] = arr[j+1], arr[j]n arr = [34, 2, 65, 87, 9, 78, 44, 55, 13, 44] nbubble_sort(arr)n print(arr)```

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Data Structures Interview Questions

What is list data structure?

1 Answers  


Is bucket sort a comparison sort?

1 Answers  


Can hashset contain duplicates?

1 Answers  


What is sorting in data structure?

1 Answers  


How many sorting are there in data structure?

1 Answers  


What is the need for path compression?

1 Answers  


How do you rotate an AVL tree?

1 Answers   Global Logic,


Why do we use collections?

1 Answers  


Which sort is best for linked list?

1 Answers  


In tree construction which is the suitable efficient data structure? (a) Array (b) Linked list (c) Stack (d) Queue (e) none

1 Answers  


Define a path in a tree?

1 Answers  


What is time complexity of bubble sort?

1 Answers  


Categories