Programming with Judy
Using Judy
Chapter 3 27
JudySL sorts are case sensitive and JudySL literally stores strings as
chunks of bytes or numbers. Sorting is numeric per the ASCII value of
the character, so the letter "A" is sorted using a different numeric
sequence than the letter "a".
For more information about sorting strings, see the “JudySL sorting
example” on page 45.
Counting You can use Judy counting functions to rapidly determine the number of
valid indexes between any pair of indexes. Judy counts the population of
any given expanse: the number of valid (stored) indexes in the expanse.
Because each node in a Judy array maintains a count of the values under
the node, Judy counts the number of keys between any two arbitrarily
defined keys in nearly constant time.
Counting functions are available through Judy1Count() and
JudyLCount(), which return counts of valid indexes between the
specified indexes (including the indexes themselves if valid). In addition,
you can use the JudyLByCount function to locate the Nth index (where
N = count) in an array and return a pointer to its value area.
Because counting happens in nearly constant time, Judy counting
functions can support many novel problem solutions, such as repeated
stack depth measurements. For more information about counting, refer
to the Judy1(3X) and JudyL(3X) man pages.