Numerically largest entry in a trie of digits

H. S. Teoh hsteoh at quickfur.ath.cx
Tue Apr 19 21:28:46 UTC 2022


On Tue, Apr 19, 2022 at 09:16:18PM +0000, Dom DiSc via Digitalmars-d wrote:
> On Tuesday, 19 April 2022 at 16:35:21 UTC, H. S. Teoh wrote:
> > Just thought I'd pick all the bright minds here: I have a set of
> > numbers in string form (as decimal digits), stored in a trie.  How
> > do I retrieve the largest number in the set?
> 
> Is it necessary to store decimal numbers?
> Because if they would be stored binary, the highest number would
> automatically be among the longest strings.

Obviously, the same holds for decimal numbers.  The question is, how to
efficiently locate it in the trie (without traversing the entire trie).


T

-- 
A linguistics professor was lecturing to his class one day. "In
English," he said, "A double negative forms a positive. In some
languages, though, such as Russian, a double negative is still a
negative. However, there is no language wherein a double positive can
form a negative." A voice from the back of the room piped up, "Yeah,
yeah."


More information about the Digitalmars-d mailing list