Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #20407

Re: name of a sorting algorithm

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!ecngs!feeder.ecngs.de!xlned.com!feeder7.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <arnodel@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.008
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; '(there': 0.09; 'bubble': 0.09; 'algorithm': 0.13; 'received:209.85.214.174': 0.13; '...,': 0.16; 'adjacent': 0.16; 'bieber': 0.16; 'called,': 0.16; 'swaps': 0.16; 'then:': 0.16; '\xc2\xa0if': 0.16; 'cc:addr:python-list': 0.16; 'wrote:': 0.18; 'cc:no real name:2**0': 0.21; 'header:In- Reply-To:1': 0.22; 'feb': 0.22; '+0100,': 0.23; 'ancient': 0.23; 'items.': 0.23; 'seemingly': 0.23; 'elements': 0.24; 'cc:2**0': 0.26; 'looks': 0.27; 'pass': 0.29; 'message-id:@mail.gmail.com': 0.29; 'cc:addr:python.org': 0.29; 'url:wiki': 0.29; 'array': 0.30; 'remaining': 0.32; 'tue,': 0.32; 'list': 0.32; 'sort': 0.33; 'lee': 0.34; 'someone': 0.34; 'received:209.85.214': 0.36; 'but': 0.37; 'received:google.com': 0.37; 'using': 0.37; 'received:209.85': 0.38; 'url:org': 0.39; 'url:en': 0.39; 'received:209': 0.39; 'selection': 0.40; 'kind': 0.62; 'subject:name': 0.67; 'dennis': 0.73; '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:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=4jUUVy61wcudN7kPqoBwMLamKmTgUUtnePoQ+/Pdv/M=; b=amCu1smuM6oBw/HRWdKc5X83VNY1w3wivnJw6wRfMTAlC+kOy2p1/vfN2dFEdrX/V+ iBh42QJyP8TvWqwDeZ7f1nGDi4fKTbMhVgE06XHIcpORlTQXGbdTMp0nV/b9AohU2icI SZNeXRHybp1HjW9zi9G/pXGPOaBveMNMUurgE=
MIME-Version 1.0
In-Reply-To <o9ukj7p7f6h3sn6p6d0hpoh09vd9rpssu8@4ax.com>
References <CAOuJsMnV0GPK=Jm=s5K7QRS1VO=wy62-H7FfaB-Y5QBitRDu=Q@mail.gmail.com> <o9ukj7p7f6h3sn6p6d0hpoh09vd9rpssu8@4ax.com>
Date Tue, 14 Feb 2012 16:22:45 +0000
Subject Re: name of a sorting algorithm
From Arnaud Delobelle <arnodel@gmail.com>
To Dennis Lee Bieber <wlfraed@ix.netcom.com>
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
Cc 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.5805.1329236568.27778.python-list@python.org> (permalink)
Lines 29
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1329236568 news.xs4all.nl 6932 [2001:888:2000:d::a6]:47284
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:20407

Show key headers only | View raw


On 14 February 2012 15:31, Dennis Lee Bieber <wlfraed@ix.netcom.com> wrote:
> On Tue, 14 Feb 2012 16:01:05 +0100, Jabba Laci <jabba.laci@gmail.com>
> wrote:
>
>>Could someone please tell me what the following sorting algorithm is called?
>>
>>Let an array contain the elements a_1, a_2, ..., a_N. Then:
>>
>>for i = 1 to N-1:
>>    for j = i+1 to N:
>>        if a_j < a_i then swap(a_j, a_i)
>>
>        Off hand... The ancient Bubble-Sort...
>
> http://en.wikipedia.org/wiki/Bubble_sort

Ahem...

No, it's not Bubble Sort.  Bubble sort only swaps adjacent terms.

I don't know what this sort is called, if it even has a name.  It's a
kind of Selection Sort, as each pass it looks for the minimum of the
remaining unsorted items.  But it ruffles the unsorted list each pass,
seemingly to save using an extra register to store the current minumum
(there was a time when registers were at a premium).

-- 
Arnaud

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


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