πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: demon.ip.developers
Article #94

Re: Need little help on 'simple' c-program

#94
From: Juergen Heinzl
Date: Sun, 07 Mar 1999 00:00
34 lines
1695 bytes
In article <36E25866.C59633B5@dds.nl>, Robbert Jager wrote:
Hello,

>I ran into the c-code of a countsort program. People say that this is
>the quickest sorting method available. Most of the source i understand
>but there are three for-loops in which i don't realy know what they
>do....

the code is trash (sorry to say that), but if you use it, then ...
[...]
>  /* ???? */
>  for (i = 0; i < n; i++)
>    {
>      ++c[a[i]];
>    }
[...]
... try this 8)

/*
** on a 32 bit machine INT_MAX is 2147483647, on a 16 bit machine
** 65535 and ++c[a[i]] will write straight into somewhere.
*/

>int a[] = { INT_MAX, 8, 6, 4, 3, 8, 0 };

... *BOOM* ... must be part of Win98 ... 8->>

Cheers,
Juergen

-- 
\ Real name     : JοΏ½rgen Heinzl                 \       no flames      /
 \ EMail Private : juergen@monocerus.demon.co.uk \ send money instead /
  \ Phone Private : +44 181-332 0750              \                  /
Technical Details
Message-ID: <slrn7e53r2.3m.juergen@monocerus.demon.co.uk>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <36E25866.C59633B5@dds.nl>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 10bb05,b154e844074fd869
X-Google-Attributes: gid10bb05,public
From: juergen@monocerus.demon.co.uk (Juergen Heinzl)
Subject: Re: Need little help on 'simple' c-program
Date: 1999/03/07
Message-ID: <slrn7e53r2.3m.juergen@monocerus.demon.co.uk>
X-Deja-AN: 452222982
Content-Transfer-Encoding: 8bit
X-NNTP-Posting-Host: monocerus.demon.co.uk:212.229.5.80
References: <36E25866.C59633B5@dds.nl>
Content-Type: text/plain; charset=iso-8859-1
X-Complaints-To: abuse@demon.net
X-Trace: news.demon.co.uk 920817561 nnrp-09:7222 NO-IDENT monocerus.demon.co.uk:212.229.5.80
Organization: Rent A Bug Ltd
Mime-Version: 1.0
User-Agent: slrn/0.9.5.4 (UNIX)
Newsgroups: demon.ip.developers