This is my implementation of a radix tree data structure. This is a data structure very similar to a trie. Basically instead of having each one of your nodes hold a char you have each one of your nodes store a string or as wikipedia puts it, it is a trie where "each node with only one child is merged with its child".

As I understand it the names radix tree and crit bit tree are only applied to trees storing integers and Patricia trie is retained for more general inputs.

As usual I am outputting the code for each class.

Then the actual tree

And the test program:

Hello Andrei,

RăspundețiȘtergereThanks for sharing your solutions.

Sorry to ask this but, what do you intend to do on line 055?

054 if ((matches == 0) || (curNode == _root) ||

055 ((matches > 0) && (matches <>= curNode.Label.Length)))

Using the operator <>=

Also on line 074

074 else if(matches < commonroot =" wordPart.Substring(0," branchpreviouslabel =" curNode.Label.Substring(matches," branchnewlabel =" wordPart.Substring(matches," label =" commonRoot;" newnodepreviouslabel =" new" newnodenewlabel =" new" matches ="="> curNode.Label.Length)

Did I miss the definition of commoroot?

Also on line 101

101 for (int i = 0; i <>

Have you finished the cycle, or you left it for us to finish it by ourselves?

Thanks!!!

Hi,

ȘtergereSorry about that. It's the syntax highlighter messing up the code.

Anyway this is the proper code for line 74:

if ((matches == 0) || (curNode == _root) ||

((matches > 0) && (matches < wordPart.Length) && (matches >= curNode.Label.Length)))

and this one for 101:

//go throught the two streams

for (int i = 0; i < minLength; i++)

{

//if two characters at the same position have the same value we have one more match

if(word[i] == curNode.Label[i])

matches++;

else

//if at any position the two strings have different characters break the cycle

break;

}

//and return the current number of matches

return matches;

}

If anyone can suggest a better syntax highlighter please do so. This one has lots of bugs.

I promise I'll upload all these codes to github or something like that as soon as I find the time.

Hi this is somashekhar i want to ask in the internal node of particia tree what it contains plz reply me???

RăspundețiȘtergereGrab the code from here: https://github.com/paratechnical/RadixTree I will try to update the code don't know why nothing is visible anymore

ȘtergereDone

Ștergere