Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!samsung!sdd.hp.com!ucsd!ucbvax!agate!shelby!neon!kanamori From: kanamori@Neon.Stanford.EDU (Atsushi Kanamori) Newsgroups: comp.edu Subject: Re: ALGORITHMS ANYBODY? Message-ID: <1990Aug23.153652.23949@Neon.Stanford.EDU> Date: 23 Aug 90 15:36:52 GMT References: <90Aug22.090345edt.9450@neat.cs.toronto.edu> <1990Aug22.182415.27036@newcastle.ac.uk> <12868@june.cs.washington.edu> Organization: Computer Science Department, Stanford University Lines: 15 In article <12868@june.cs.washington.edu> pattis@cs.washington.edu (Richard Pattis) writes: > >What exactly is wrong with bubble sort? Because there are two other N**2 algorithms that are just as intuitive (more, imho) and are more efficient. If I were teaching sorting algorithms, I would much prefer that the students adopt insertion or selection sort as their quick & dirty standby. Bubblesort is basically a selection sort where the "find smallest element" part is written incredibly inefficiently and performs a lot of extra swaps that don't need to be there. Whereas selection sort moves the smallest element to the top in one swift leap, bubblesort does it the hard way by bubbling it up using multiple swaps. Seems like an unnecessary burden, both on the cpu & human brain.