<cyrus>
01 Tree
I dont get it! the tree used in lzma is confusing.
How does it work ?
How does it maintain the tree for searching strings ?
<Shelwien>
just a binary tree of strings
like, if( p.s<s ) p=p.ptr[1]; else p=p.ptr[0];
<cyrus>
It dosent look like normal binary tree. The most recent offset is
stored in the hash. usually when we build a tree the oldest offset
are at the top so we get those. but here i see he gets the most
recent offsets first then the older ones but HOW ?
I cant think of how to build a tree in reverse with recent offsets
at top and older ones near leaves
how how how
<Shelwien>
it just adds a new root to a tree every time
with some little link updates along the search path
but the tree is far from balanced, so its not very efficient
but still, its more efficient than a plain chain
also obviously there's not one tree, but one per each hashtable entry
<cyrus>
:(
I tried to figure out the code but failed. i see that the new hash
is updated with current position. and offsets from recent to old are
searched for matches.
the most recent one is replaced with current. and next search offset
is replaced with previous one and so on
but how is the pointer stuff maintained in that cyclicbuffer is dam
confusing i cant get a big picture of whats going on
if string is less ptr1 is adjusted else ptr0
and cyclicpos is used to index the offsets somehow
what kind of datastructure is this.