What is Bubble Sort?
Bubble sort is a straightforward sorting method that involves comparing two adjacent elements and sending the larger one to the back.
Key Features
-
Adjacent Element Comparison
: It sequentially compares adjacent elements for sorting. -
Swap After Comparison
: If adjacent elements are not in the desired order, they are swapped. -
Repetition
: The entire array is iterated multiple times for sorting. -
Poor Time Complexity (O(n²))
: Bubble sort is a somewhat inefficient sorting method with a time complexity proportional to the square of the number of elements.
Lecture
AI Tutor
Publish
Design
Upload
Notes
Favorites
Help