Learn Before
Code
Bubble Sort with Recursion
class bubbleSort: def bubbleSortRecursive(self, n=None): if n is None: n = self.length # Base case if n == 1: return for i in range(n - 1): if self.array[i] > self.array[i + 1]: self.array[i], self.array[i + 1] = self.array[i + 1], self.array[i] self.bubbleSortRecursive(n - 1)
0
1
Updated 2021-07-20
Tags
Python Programming Language
Data Science