Programming with Judy
Using Judy
Using JudyL
Chapter 334
JudyL example You can find the code for this example and others on the Judy web site:
http://devresource.hp.com/judy/
// FUNCTION HISTOGRAM; JUDYL DEMO PROGRAM
//
// This program uses JudyL to create a histogram of data generated by the
// function random(3M). Other functions could be substituted in.
//
// The program generates n random numbers, stores them in a JudyL array
// and then prints a histogram. All aspects of the generation and
// histogram are timed so the user can see how long various JudyL functions
// take.
//
// This demonstrates:
// JudyLIns
// JudyLFirst
// JudyLNext
// JudyLLast
// JudyLCount
// JudyLByCount
// how to access a JudyL value.
//
// Notice that using JudyL gives you fast stores and lookups as with hashing
// but without having to define a hash function, initialize the hash table
JudyLCount Returns the count of set indexes between two specified
indexes, including the specified indexes themselves.
JudyLByCount Locates the Nth index (N = count) that is set in the
JudyL array.
JudyLFreeArray Frees the entire JudyL array. This is much faster
than using JudyLNext and JudyLDel.
Table 3-3
JudyL functions Actions