Algorithm: Bubble Sort
Goal: Sort an array of numbers in ascending order using the Bubble Sort technique.
Steps:
- Start
- Input
n(number of elements in the array). - Input the array
arr[0…n-1]. - For
i = 0ton-2:- For
j = 0ton-i-2:- If
arr[j] > arr[j+1]:- Swap
arr[j]andarr[j+1].
- Swap
- If
- For
- Print the sorted array.
- Stop
Flowchart: Bubble Sort

Post Comment