Click here to Skip to main content
11,410,529 members (56,384 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as

Bubble sort modifications

, 3 Nov 2012 CPOL
To handle the "no swap" situation, here is my proposal: When entering the outer loop, save the value of i in a temporary variable and set i to length - 1 (this value will cause an exit at the next iteration). And in the body of the if test (i.e. when a swap is made), restore the value of...



Compare Revision Minor Date Status Editor
2 - publicly available No 3-Nov-12 19:07 Available YvesDaoust
Updates in content. 4 changes had been made.
1 No 3-Nov-12 19:05 Available YvesDaoust


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Belgium Belgium
I fell into applied algorithmics at the age of 16 or so. This eventually brought me to develop machine vision software as a professional. This is Dreamland for algorithm lovers.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.150414.5 | Last Updated 3 Nov 2012
Article Copyright 2012 by YvesDaoust
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid