This invention provides a novel means for creating a histogram for use in
minimizing response time and resource consumption when optimizing a query
in a database, and other like structures, the histogram being created by
placing ordered elements into specific range until the next element to be
considered for inclusion in the range is a predetermined distance from the
(generalized) mean value associated with the elements within the range,
whereupon that next element is placed in the following range. Similarly,
the following ranges are closed when the next element to be considered for
inclusion in the range is greater than a predetermined distance from the
(generalized) mean value associated with the elements in that range,
whereupon that next element is placed in the following range. For each
range, the location and size of the range is recorded with, for example,
the mean value, the slope or other attribute characterizing one or more
elements in the range. The invention has also applications in pattern
recognition, message routing, and in actuarial sciences.