What are differences between segment trees, interval trees, binary indexed trees and range trees in terms of:
Not that I can add anything to Lior's answer, but it seems like it could do with a good table.
k
is the number of reported results
| | Segment | Interval | Range | Indexed |
|--------------|--------------:|-----------:|---------------:|----------:|
|Preprocessing | n logn | n logn | n logn | n logn |
|Query | k+logn | k+logn | k+logn | logn |
|Space | n logn | n | n | n |
| | | | | |
|Insert/Delete | logn | logn | logn | logn |
d > 1
| | Segment | Interval | Range | Indexed |
|--------------|--------------:|-----------:|---------------:|----------:|
|Preprocessing | n(logn)^d | n logn | n(logn)^d | n(logn)^d |
|Query | k+(logn)^d | k+(logn)^d | k+(logn)^d | (logn)^d |
|Space | n(logn)^(d-1) | n logn | n(logn)^(d-1)) | n(logn)^d |
These tables are created in Github Formatted Markdown - see this Gist if you want the tables formatted nicely.
All these data structures are used for solving different problems:
Performance / Space consumption for one dimension:
(k is the number of reported results).
All data structures can be dynamic, in the sense that the usage scenario includes both data changes and queries:
Higher dimensions (d>1):