Two simple approaches:

1. Use a sorted, random-access data structure. A vector will suffice.  
Store your data in this. This is good if your data doesn't change much.

Find the extremes of a range by binary search and linear walking. If  
that's too slow, build a metaindex, which is simply a precalculated  
binary search to a certain depth.

A lookup is then the computation of two indices. Your values lie  
between those indices.


2. Store your values in a tree. Each node stores the range it  
contains. Navigate the tree appropriately to find matching values.  
This will take more space than the array.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to