AdvancedAlgorithms.DNAMatcher.SuffixTree.ConstructTree C# (CSharp) Method

ConstructTree() public method

Constructs a tree with the supplied text Does this by looping through the string character by character from start to end. Creates suffixes for each character from that point on ie SOCCER OCCER CCER CER ER R on first loop then adds those to the tree When those are added to the tree, the tree is checked to see if they already contain those exact ones If the first one is there, its rmeoved, adn second one is checked, this is dwindled until it gets to the last X about that aren't already present. These are added as a subset of the current position ie if it gets to SOCC and realises that CER isnt there it adds CER ER and R as children this is repeated again with OCCER CCER CER ER R and so on
public ConstructTree ( string text, int stringNumber ) : void
text string
stringNumber int
return void
            public void ConstructTree(string text, int stringNumber)
            {
                for (int i = 0; i < text.Length; i++)
                {
                    //create a list of all suffixes from this letter on
                    //this list will be dwindled down to only new suffixes
                    List<String> suffixList = new List<String>();
                    for (int k = i; k < text.Length; k++)
                        suffixList.Add(text[k] + "");
                    this.root.AddSuffix(suffixList, stringNumber);
                }
            }