"AAA" 16 32
"BBB" 16 56
"CCC " 80 128
"DDD" 40 192
"EEE" 56 96
(The numbering convention I used for the nodes is as follows. The root
gets id 1. Every left child gets 2*parent_id and every right child gets
2*parent_id+1.
This is one possibility. You do not necessarily have to follow this.)
Output for %mktimeindex input.txt (or %java mktimeindex input.txt)
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: 8Node 9
Low: 16
High: 32
Lines: AAA, BBB
Parent: 4
Low: 32
High: 64
Lines: nil
Node 18
Parent: 9Node 37
Low: 32
High: 48
Lines: BBB
Parent: 18Node 19
Low: 40
High: 48
Lines: DDD
Parent: 9
Low: 48
High: 64
Lines: DDD
Node 38
Parent: 19
Low: 48
High: 56
Lines: BBB
Node 39
Parent: 19Node 5
Low: 56
High: 64
Lines: EEE
Parent: 2Node 10
Low: 64
High: 128
Lines: DDD
Parent: 5Node 21
Low: 64
High: 96
Lines: EEE
Parent: 10
Low: 80
High: 96
Lines: CCC
Node 11
Parent: 5Node 3
Low: 96
High: 128
Lines: CCC
Parent: 1Node 6
Low: 128
High: 255
Lines: nil
Parent: 3
Low: 128
High: 192
Lines: DDD
A pictorial depiction of the tree could be as follows:
(This is also a preorder traversal of the tree. I would be great if
you could use indentation like this when you print the tree, as this makes
the tree so much more understandable. But this is not a requirement.)
0-255
0-128
0-64128-2550-3264-128 (DDD)NIL32-64
16-32 (AAA,BBB)32-48 (BBB)NIL48-64 (DDD)
40-48 (DDD)48-56 (BBB)
56-64 (EEE)64-96 (EEE)NIL96-128 (CCC)
80-96 (CCC)128-192 (DDD)
NIL