Re: Bubble Sort in C
- From: Nick Keighley <nick_keighley_nospam@xxxxxxxxxxx>
- Date: Tue, 15 Sep 2009 04:01:21 -0700 (PDT)
On 15 Sep, 05:29, arnuld <arnuld.miz...@xxxxxxxxx> wrote:
On Sep 15, 6:37 am, user923005 <dcor...@xxxxxxxxx> wrote:
Writing a better bubble sort is about as valuable as polishing a Yak.
Sure, once in a while there may be a "Who's got the shiniest Yak"
contest, but how often do the masses experience such a contest?
I'm not sure I agree with this
You are saying that the exercise I did was purely academic (not
practical).
writing almost *any* code when you are learnign is "practical".
I don't need a farenheit to centigrade converter program (I have
a table next to my heating controls) but it's still a useful
excercise in K&R. I don't understand why "academic" is used
as a synonym for "useless".
Remember I am not student anymore
well I am. I'm still learnign things and I don't plan to stop.
I *graduated* yonks ago.
<snip>
I am not thrashing you. I have academic exercises which theoretical to
the point of totally unrelated to the real world programming. So, if
you think my ways of learning algorithms are not practical, you must
have something better to offer.
well you have chosen a rather poor algorithm to play with.
I'm not sure reinventing wheels like this is going to teach you much.
Get a decent book on algorithms. Sedgewick (or if brave, Knuth)
they'll explain the various trade-offs the algorithms exhibit.
Bubble sort is so bad that I think it a terrible disservice that it is
a common choice in algorithms teaching courses, even though insertion
sort is easily just as simple and far more effective. Now, if bubble
sort is taught in an algorithms course as an example of "Don't do it
this way!" then I have no objection to its inclusion.
If other regular posters say that Bubble-Sort is inherently bad idea
(except of the 2 cases you mention in an earlier reply) then I will
not use in the code I write for my employer. BTW, next algorithm in
Ullman's book is insertion sort :)
Bubble sort is bad. For small numbers of elements Insertion Sort beats
it
and for large numbers of elements Quick Sort beats it. Insertion Sort
is simpler to code.
"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" D.E.Knuth
.
- References:
- Bubble Sort in C
- From: arnuld
- Re: Bubble Sort in C
- From: Mark Bluemel
- Re: Bubble Sort in C
- From: arnuld
- Re: Bubble Sort in C
- From: user923005
- Re: Bubble Sort in C
- From: user923005
- Re: Bubble Sort in C
- From: arnuld
- Bubble Sort in C
- Prev by Date: Re: Sizeof query
- Next by Date: Re: Bubble Sort in C
- Previous by thread: Re: Bubble Sort in C
- Next by thread: Re: Bubble Sort in C
- Index(es):
Relevant Pages
|