POV-Ray : Newsgroups : povray.off-topic : Nice data structure : Re: Nice data structure Server Time
5 Sep 2024 15:29:31 EDT (-0400)
  Re: Nice data structure  
From: Warp
Date: 20 Jun 2009 14:53:06
Message: <4a3d300f@news.povray.org>
Darren New <dne### [at] sanrrcom> wrote:
> I think that would work with the caveat that you have to distinguish between 
> nodes without a child and nodes whose only child is '\0'.  That is, not all 
> your branches will end in a '\0' as shown in the picture.

  Each node needs a bit of information denoting whether it's an end node
or not (ie. whether that node is the last character of a string stored in
the data structure or not) regardless. For example, if you store "CAT" and
"CATS" as two separate strings, you'll need a bit in the 'T' node to
indicate that there exists a string which end there.

  Doing it like I suggested doesn't change anything. For the extraneous
nodes you simply set the bit to "no string ends here".

-- 
                                                          - Warp


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.