Computergeek01 wrote: |
---|
With all due respect Duoas, you're making this statement in a thread that shows you completely missing the point of why bubble sort is taught to beginners. It's not about the sorting method at all, it's used to illustrate embedded loops. |
With all due respect yourself,
LOL.
Frankly, your statement pegs you as a complete neophyte. You do know that I work in education, right?
Nested loops and sorting algorithms are two distinct concepts, taught at different levels.
Nested loops are typically taught with variations of star pyramid and 2D arrays / matrices, which are
much better-suited to the targeted learner objective for understanding nested loops.
And, frankly, anyone teaching nested loops with bubble sort ought to be fired, if for no other reason than he/she is oblivious to the confusion it causes in his/her students. Every educator worth his/her salt knows that confusion indicates a need to reevaluate and prune the current strategy. Failure to do so is, shall we say, cause for concern. (Remediation is indicated.)
Conway's Game of Life is likewise unsuited for the job. Managing the 2D array is the
simplest part of such an exercise. And the console problem is a red herring. (Not that it makes a difference. The code can be just as clear on the console as with a GUI:
http://www.cplusplus.com/forum/lounge/75168/)
There is a clear preponderance of evidence that bubble sort is
not intuitive and causes confusion (even among experts).
Wikipedians confused about bubble sort
http://en.wikipedia.org/wiki/Talk%3ABubble_sort
(Apparently someone had placed mal-formed insertion sort pseudocode on the Wiki -- see the stuff under Wikicode and compare/swap indices being i and j instead of j and j+1. Notice also all the other stuff about it that knowledgeable people are having trouble getting right. It's a fairly large page for such a simple algorithm.)
Here's some other people who agree with me, not the least of which is
Donald Knuth, who disparages it:
The Art of Computer Programming: Sorting and Searching, 2 ed., vol. 3. Addison-Wesley, 1998 wrote:
In short, the bubble sort seems to have nothing to recommend it, except a catchy name and the fact that it leads to some interesting theoretical problems. |
Here's from the CS Department at
Duke University, replete with references
http://www.cs.duke.edu/~ola/bubble/bubble.html
Eric S. Raymond, et. al claim that using the bubble sort at all is naïve, an error foisted on the ignorant.
http://catb.org/jargon/html/B/bubble-sort.html
This fellow in Finland makes the most direct damning observations
http://warp.povusers.org/grrr/bubblesort_eng.html
http://warp.povusers.org/grrr/bubblesort_misconceptions.html
Even Barack Obama (studied constitutional law) knows better than to Bubble Sort
http://www.youtube.com/watch?v=k4RRi_ntQc8
But hey, who cares anyway? I should have known better than to make a statement like "bubblesort is evil". It's just flame bait for the
hoi polloi armchair experts.
Cause I really don't care to hear all the useless arguments defending poor, little bubble sort.