Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!zephyr.ens.tek.com!uw-beaver!uw-june!pattis From: pattis@cs.washington.edu (Richard Pattis) Newsgroups: comp.edu Subject: Re: ALGORITHMS ANYBODY? Summary: Meet me at high noon Message-ID: <12872@june.cs.washington.edu> Date: 23 Aug 90 18:48:09 GMT References: <90Aug22.090345edt.9450@neat.cs.toronto.edu> <1990Aug23.153652.23949@Neon.Stanford.EDU> Organization: U of Washington, Computer Science, Seattle Lines: 24 In article <1990Aug23.153652.23949@Neon.Stanford.EDU>, kanamori@Neon.Stanford.EDU (Atsushi Kanamori) writes: > 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. OK; choose your language and write either of those sorting procedures; I'll write bubble sort. Then, write a one paragraph justification of why your sorting procedure works; I'll do the same. The justification should include a demonstration that the array is sorted, and a permutation of the input array. Rich