[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Trie search algorithm

Justin To

6/13/2008 5:43:00 PM

I'm lost--can't figure out the algorithm to output a trie.

class Trie
@value
@children = [] # array of tries
@number_exists # bool
end

0 # Root = nil
/
1 => number_exists = true(#1)
/
1 => number_exists = true(#11)
/ => 1 => true(#111)
/ => 2 => true(#1112)
/ => 2 => true(#112)
/ => 5 => true(#1125)
0 => number_exists = true(#110)

Any help is much appreciated, thanks!

Justin
--
Posted via http://www.ruby-....