TL;DR: What data structure should I use for looking up key-value pairs where the key needs to fall within a range?
TL;DR: What data structure should I use for looking up key-value pairs where the key needs to fall within a range?
I'm looking for something like a TDictionary but with a twist.
I have a HexEditor with lines, say 8 bytes per line (this can and does differ though).
Any byte within the memblock displayed by the hexeditor can have a comment.
I thought about storing the comments in a TDictionary however that will not work, because I need to lookup if the comment falls within a range and a Dict only matches on exact matches.
The range can change dynamically so I can't link to that either.
I don't want to do a query to the Dict for every byte in a line.
I suspect the answer is "binary tree" but I'm hoping for something a bit more O(1)ish.
(I'd ask the question on SO, but it's off-topic there).
I'm looking for something like a TDictionary but with a twist.
I have a HexEditor with lines, say 8 bytes per line (this can and does differ though).
Any byte within the memblock displayed by the hexeditor can have a comment.
I thought about storing the comments in a TDictionary
The range can change dynamically so I can't link to that either.
I don't want to do a query to the Dict for every byte in a line.
I suspect the answer is "binary tree" but I'm hoping for something a bit more O(1)ish.
(I'd ask the question on SO, but it's off-topic there).
David Millington Not in 1.2 but in a version after that.
ReplyDeleteAttila Kovacs
ReplyDeletehm yes.