🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #62453

Re: Ode to the xBin (xMas?) trees

#62453
From: Curt Welch
Date: Thu, 26 Dec 2002 19:28
58 lines
3455 bytes
Rene <invalid@email.addr> wrote:
> Been thinking about the hashTree structure again.
>
> And again (*sigh*) I think I've found the solution to the right-subtree
> of skewed trees.
>
> But before I'm going to post some real or pseudo code again, that won't
> work correctly, I'm going to write a small test-programm and I will test
> my formula toroughly.
>
> I basically found a method, to map non-powerOfTwo(po2) trees on po2
> trees. And po2-trees are easy to calculate:
>
> For any po2 tree with N (1..N) nodes, a sequence (a,b) (inclusive) has to
> include exactly bitcount(a - 1) + bitcount(N - b) hashes. (Number of 1's
> in the value of nodes to the left of the sequence plus number of 1's in
> the value of nodes to the right of the sequence)

Yeah, I agree with that.

> Now this doesn't work for non po2 trees, but I've found an easy mapping.
> I'll test it and will post the code/algorithm if it turns out correct.

Cool.

> As a sideeffect, I now have found the worst case of hashes to
> transport. worst case is = sequence contains only rightmost hash of the
> *left* subtree IF the right subtree has only one hash/node, else the
> sequence spanning the rightmost node of the left subtree and the leftmost
> node of the right subtree (ie nodes in the middle).

so that's either a 1 or 2 hash-block part which starts with the rightmost
block of the left subtree?  That sounds like it could be right.  The 2
block post centered in the file is the obvious worst case for a po2 tree
and for a non po2 tree, the right tree might be worse if you don't take the
block out so for that, the 1 block post would be the worse.

So, this points out that for file which are po2 in size, it's easy to
calcuate the worst case, so we could look at a 2GB file and know the worst
case.

Ah, but, is it possible for a smaller file (2B - 1 block) to have a worse
case signature size which has more hash values than the po2 tree?

Or, for any file size, will the worse case get better, if you add more
blocks?

Or, asking it another way, does the worse case function when ploted against
file size, always increase or stay the same as the file size increases?

> Ok so much for now. Rest should follow as soon as I'm certain it holds

Sounds good.

-- 
Curt Welch                                            http://CurtWelch.Com/
curt@kcwc.com                          Webmaster for http://NewsReader.Com/
Technical Details
Message-ID: <20021226142834.692$qr@newsreader.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!feed3.newsreader.com!newsreader.com!news2.newsreader.com!ellis.newsreader.com!not-for-mail
References: <20021226102324.117$5X@newsreader.com>

Show Full Headers
Complete Article Headers
Message-ID: <20021226142834.692$qr@newsreader.com>
Subject: Re: Ode to the xBin (xMas?) trees
Date: Thu, 26 Dec 2002 19:28:34 +0000
From: curt@kcwc.com (Curt Welch)
References: <20021226102324.117$5X@newsreader.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!feed3.newsreader.com!newsreader.com!news2.newsreader.com!ellis.newsreader.com!not-for-mail
Organization: NewsReader.Com
Newsgroups: news.software.nntp
X-Trace: NewsReader.Com wTvSj+qvtO,2XQfByNYKIz8440Bd@dEZ3b+kvLiFW-.YwzOGh
X-Face: "p}G*1KH{+F7EYGKLb>ogDguabZ+%,?^epeFB!nzu`)`$=QcvL1KF6<0GH!Tbc!Sqo[|tV5
  %IW48mQf3K=Ci&gZ7]]aazx@]Y-nq!r5{yH/#,?@lDdUDvOfByB2hVW0.@OM%{l/{cT'{w
X-Url: http://CurtWelch.Com/
User-Agent: NewsReader.Com
Lines: 57