Refer: Main indexed article on sorting.
Bubble sort is a simple sorting algorithm that works by:
This indicates that the list is sorted.
Note: Bubble sort should be avoided in case of large collections (large number of elements).
Algorithm:
Bubble sort is a simple sorting algorithm that works by:
- Repeatedly going through the list to be sorted
- Comparing each pair of adjacent items
- Swapping them if they are in the wrong order
This indicates that the list is sorted.
Note: Bubble sort should be avoided in case of large collections (large number of elements).
Algorithm:
Java code Snippet:
No comments:
Post a Comment