🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.java
Article #425

Re: Finding 2 biggest numbers in a row

#425
From: Ares Lagae
Date: Sat, 09 Dec 2000 14:38
15 lines
1855 bytes
Very easy using bottom-up recursion:
-> trivial case: row of lenghth 2 -> these 2 numbers are the biggest
-> combination step: search the 2 biggest numbers out of 4 numbers
ur row is of ^2 length, thus implementation should be straigth forward

Pseudo code:

proc search2biggest(row, left, right)
if (right - left) = 2 //trivial case
    return the 2
else // non-trivial case -> split up
    a, b = search2biggest(row, left, left + right mod 2)
    c, d = search2biggest(row, left + right mod 2 + 1, right)
    return the two biggest out of (a, b, c, d)
end
Technical Details
Message-ID: <3A324451.7981AB21@pandora.be>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!isdnet!newsfeeds.belnet.be!news.belnet.be!afrodite.telenet-ops.be!not-for-mail
References: <3A11B99A.2BB2E1E7@skynet.be>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 113ae9,470c011dba4db9c3
X-Google-Attributes: gid113ae9,public
X-Google-Thread: f5d71,470c011dba4db9c3
X-Google-Attributes: gidf5d71,public
X-Google-Thread: fcea4,470c011dba4db9c3
X-Google-Attributes: gidfcea4,public
X-Google-Thread: 10a146,470c011dba4db9c3
X-Google-Attributes: gid10a146,public
X-Google-ArrivalTime: 2000-12-09 06:38:09 PST
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!isdnet!newsfeeds.belnet.be!news.belnet.be!afrodite.telenet-ops.be!not-for-mail
Message-ID: <3A324451.7981AB21@pandora.be>
From: Ares Lagae <ares.lagae@pandora.be>
X-Mailer: Mozilla 4.7 [en] (Win98; I)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: comp.lang.java,comp.lang.java.help,comp.lang.java.programmer,be.comp.programming
Subject: Re: Finding 2 biggest numbers in a row
References: <3A11B99A.2BB2E1E7@skynet.be>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 16
Date: Sat, 09 Dec 2000 14:38:04 GMT
NNTP-Posting-Host: 213.224.118.63
X-Complaints-To: abuse@pandora.be
X-Trace: afrodite.telenet-ops.be 976372684 213.224.118.63 (Sat, 09 Dec 2000 15:38:04 MET)
NNTP-Posting-Date: Sat, 09 Dec 2000 15:38:04 MET
Organization: Pandora - Met vlotte tred op Internet