June 30th, 2003, 06:42 PM
map to hold intervals
I am trying to come up with the best combination of data structures and algorithms to achieve this goal:
I have a file of continuous data that I have to discretize. I have an algorithm that generates the discrete value intervals. An example of the output of my function is as follows:
0 --> (2.4, 5.6]
1 --> (5.6, 7.9]
2 --> (7.9, 11.5]
The numbers in the brackets indicate the interval for that discrete value. (2.4, 5.6] means that all values MORE THAN ( implied by '(' ) 2.4 and less that OR EQUAL (implied by ']') to 5.6 have a discrete value of 0.
The problem is that I don't know how to store this information. In my program, I will need to take in a whole new file of continuous data and then classify it using the cuts i produced. So there will be a lot of searching through the data structure to see where one value falls. But since I have float values, this makes it harder. How can I store such information in a hash map or map?? Is there any way to look up data in the structure using > and < to index the key? Suppose I had a value of 8.999. How could I compare such a value to the keys in my structure......if anyone knows what I am trying to figure out, I would appreciate any help!