Feb-11-2020, 05:38 PM
Nono,
['ab', [3, 8], 'b', [5], 'a', [7], 'b', 'a', [10], 'b', [12], 'a']
This tree above stores 2 branches 'abab' and 'baba'. My tree could store every 8 letters in 10MB of wikipedia text and you could find every 8 letters stored in the list. If you want to find 'baba' you always start at the very first item in the list - 'ab', you find where your first letter is (2nd position, assuming it is there), then you always go to next item '[3, 8]' and you'll pick the 2nd position number '8' because 'b' was 2nd position, and it points you to the 8th item 'a'. From there you have left to search 'a', [10], 'b', [12], 'a'].....a points you to item 10 'b', then 'a'. It doesn't matter how many 'b's are in the list :) you can only be directed to the item you can go to. I'm wondering if my code is compact or could be smaller.
['ab', [3, 8], 'b', [5], 'a', [7], 'b', 'a', [10], 'b', [12], 'a']
This tree above stores 2 branches 'abab' and 'baba'. My tree could store every 8 letters in 10MB of wikipedia text and you could find every 8 letters stored in the list. If you want to find 'baba' you always start at the very first item in the list - 'ab', you find where your first letter is (2nd position, assuming it is there), then you always go to next item '[3, 8]' and you'll pick the 2nd position number '8' because 'b' was 2nd position, and it points you to the 8th item 'a'. From there you have left to search 'a', [10], 'b', [12], 'a'].....a points you to item 10 'b', then 'a'. It doesn't matter how many 'b's are in the list :) you can only be directed to the item you can go to. I'm wondering if my code is compact or could be smaller.