Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #20418
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <ian.g.kelly@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.007 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'one?': 0.05; 'passes': 0.05; '"""': 0.07; 'bubble': 0.09; 'indicates': 0.09; 'received :mail-lpp01m010-f46.google.com': 0.09; 'am,': 0.12; 'algorithm': 0.13; 'adjacent': 0.16; 'gradually': 0.16; 'selects': 0.16; 'sorted,': 0.16; 'swaps': 0.16; 'variable.': 0.16; 'cc:addr :python-list': 0.16; 'wrote:': 0.18; 'repeated': 0.18; 'thus': 0.21; 'header:In-Reply-To:1': 0.22; 'feb': 0.22; 'end,': 0.23; 'pair': 0.23; 'works.': 0.23; 'elements': 0.24; 'cc:2**0': 0.26; 'separate': 0.28; 'described': 0.28; 'needed,': 0.28; 'order.': 0.28; 'repeatedly': 0.28; 'pass': 0.29; 'message- id:@mail.gmail.com': 0.29; 'cc:addr:python.org': 0.29; 'url:wiki': 0.29; 'array': 0.30; 'ago': 0.31; 'actually': 0.31; 'received:209.85.215.46': 0.32; 'tue,': 0.32; 'list': 0.32; 'agree': 0.33; 'rather': 0.34; 'hi,': 0.34; 'pass.': 0.34; 'stores': 0.34; 'list.': 0.35; 'moving': 0.35; '(for': 0.35; 'largest': 0.36; 'comparing': 0.37; 'element': 0.37; 'but': 0.37; 'shows': 0.37; 'received:google.com': 0.37; 'either': 0.37; 'received:209.85': 0.38; '2nd': 0.38; 'think': 0.38; 'smaller': 0.39; 'url:org': 0.39; 'url:en': 0.39; 'received:209.85.215': 0.39; 'received:209': 0.39; 'called': 0.40; 'selection': 0.40; 'simple': 0.61; 'believe': 0.65; 'maximum': 0.66; 'subject:name': 0.67; '1st': 0.70; '11:10': 0.84; 'gif': 0.84; 'gif.': 0.84; 'sort.': 0.91 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=JsE6eHJtFjcuUep8zEVjvPLXKwNWKNDHixeE/I88YbA=; b=rrKlZki4UjdUxwghm1b1TBQwO4mmR1BaIqjv18KyfxVjRD+unuRRbuZZrmABeKi45j T5A5Y+thAxJrxyuPGgV5apcBuRJ6tTHFepC3zkn644E4By0CfrrObPLYaimY80tAG61w EOlqJc9X9iNGW2TV+67CxStqzzMnVHLkY7mag= |
| MIME-Version | 1.0 |
| In-Reply-To | <CAOuJsMn_a-8YMmeXWE2daHUzpqZqc9mNwQK9p1hbO2hcVNJJ3w@mail.gmail.com> |
| References | <CAOuJsMnV0GPK=Jm=s5K7QRS1VO=wy62-H7FfaB-Y5QBitRDu=Q@mail.gmail.com> <o9ukj7p7f6h3sn6p6d0hpoh09vd9rpssu8@4ax.com> <mailman.5805.1329236568.27778.python-list@python.org> <73b8d112-9e94-486e-b06c-bdeebc0bf964@q12g2000yqg.googlegroups.com> <CALwzidkaPaGFxjzG93SdL+pJNJb4LNiX=BUZXa+N6XoqVhQ8-w@mail.gmail.com> <CAOuJsMn_a-8YMmeXWE2daHUzpqZqc9mNwQK9p1hbO2hcVNJJ3w@mail.gmail.com> |
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | Tue, 14 Feb 2012 13:59:00 -0700 |
| Subject | Re: name of a sorting algorithm |
| To | Jabba Laci <jabba.laci@gmail.com> |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | quoted-printable |
| Cc | Python mailing list <python-list@python.org> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.5813.1329253173.27778.python-list@python.org> (permalink) |
| Lines | 36 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1329253173 news.xs4all.nl 6950 [2001:888:2000:d::a6]:48245 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:20418 |
Show key headers only | View raw
On Tue, Feb 14, 2012 at 11:10 AM, Jabba Laci <jabba.laci@gmail.com> wrote: > Hi, > >> Either you're misremembering, or the algorithm you programmed 43 years >> ago was not actually bubble sort. Quoting from Wikipedia: >> >> """ >> Bubble sort, also known as sinking sort, is a simple sorting algorithm >> that works by repeatedly stepping through the list to be sorted, >> comparing each pair of adjacent items and swapping them if they are in >> the wrong order. The pass through the list is repeated until no swaps >> are needed, which indicates that the list is sorted. The algorithm >> gets its name from the way smaller elements "bubble" to the top of the >> list. >> """ > > I don't agree with the last sentence. During bubble sort, in the 1st > pass the largest element is moved to the top (for me "top" means the > right side (end) of an array). Thus the end of the array is sorted. In > the 2nd pass, the largest element of the unsorted left part is moved > to the end, etc. That is, it's the _larger_ elements that bubble to > the top. At http://en.wikipedia.org/wiki/Bubble_sort you can find an > animated gif that shows how the algorithm works. I think that by "top" they mean "front". Each largest element in turn gets moved to the end in a single pass. It is the smaller elements gradually moving toward the front over many passes that I believe is described as "bubbling", as can be seen in that gif. > If the "noname" algorithm is called "selection sort", then its name > can be misleading. One may ask "OK, but which one? Minimum or maximum > selection sort?". Well, neither... It is a minimum selection sort, because it selects the minimum element on each pass. It just stores the minimum element so far in-place in the array, rather than in a separate variable.
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: name of a sorting algorithm Arnaud Delobelle <arnodel@gmail.com> - 2012-02-14 16:22 +0000
Re: name of a sorting algorithm Den <patentsvnc@gmail.com> - 2012-02-14 08:55 -0800
Re: name of a sorting algorithm Mel Wilson <mwilson@the-wire.com> - 2012-02-14 12:04 -0500
Re: name of a sorting algorithm Ian Kelly <ian.g.kelly@gmail.com> - 2012-02-14 10:37 -0700
Re: name of a sorting algorithm Jabba Laci <jabba.laci@gmail.com> - 2012-02-14 19:10 +0100
Re: name of a sorting algorithm Ian Kelly <ian.g.kelly@gmail.com> - 2012-02-14 13:59 -0700
csiph-web