%intersectquery <filename> A B
You may assume that B >= A and that A,B corresponds to the open interval [A,B)
You may assume an event '"AAA" 16 32' specified in the input file corresponds
to the open interval [16,32).
Just to be consistent with the sample input of part 4, I will keep
the root of the segment tree as [0,255).
I am using the same input file as in part 4.
In addition to reporting the relevant intervals, intersectquery should
also dump the segment tree corresponding to the
input file in a file named segment_tree.txt
The input file input.txt:
"AAA" 16 32
"BBB" 16 56
"CCC " 80 128
"DDD" 40 192
"EEE" 56 96
The segment_tree.txt file for all of the following queries:
Node 1
Parent: none
Low: 0
High: 255
Lines: nil
Node 2
Parent: 1
Low: 0
High: 128
Lines: nil
Node 4
Parent: 2
Low: 0
High: 64
Lines: nil
Node 8
Parent: 4
Low: 0
High: 32
Lines: nil
Node 17
Parent: 8
Low: 16
High: 32
Lines: AAA, BBB
Node 9
Parent: 4
Low: 32
High: 64
Lines: nil
Node 18
Parent: 9
Low: 32
High: 48
Lines: BBB
Node 37
Parent: 18
Low: 40
High: 48
Lines: DDD
Node 19
Parent: 9
Low: 48
High: 64
Lines: DDD
Node 38
Parent: 19
Low: 48
High: 56
Lines: BBB
Node 39
Parent: 19
Low: 56
High: 64
Lines: EEE
Node 5
Parent: 2
Low: 64
High: 128
Lines: DDD
Node 10
Parent: 5
Low: 64
High: 96
Lines: EEE
Node 21
Parent: 10
Low: 80
High: 96
Lines: CCC
Node 11
Parent: 5
Low: 96
High: 128
Lines: CCC
Node 3
Parent: 1
Low: 128
High: 255
Lines: nil
Node 6
Parent: 3
Low: 128
High: 192
Lines: DDD
Some sample queries with results:
%intersectquery input.txt 16 64
Found events AAA, BBB, DDD, EEE
%intersectquery input.txt 48 56
Found events DDD, BBB
%intersectquery input.txt 48 57
Found events DDD, BBB, EEE
%intersectquery input.txt 200 220
Found nothing
%intersectquery input.txt 0 255
Found events AAA, BBB, DDD, EEE, CCC
Please note that the same event name should not occur multiple times
in the output.