Ukkonen’s suffix tree construction: Difference between revisions
Content deleted Content added
No edit summary |
Thundergnat (talk | contribs) m syntax highlighting fixup automation |
||
Line 22:
As the task doesn't say whether overlapping sequences are to be counted, I've assumed that they are as this is what the algorithm naturally produces.
<
import (
Line 272:
fmt.Printf(" (this took %s)\n\n", elapsed)
}
}</
{{out}}
Line 301:
{{trans|Go}}
Uses array indices instead of the Go version's node pointers.
<
"""The suffix-tree's node."""
Line 479:
testsuffixtree()
</
<pre>
Longest Repeated Substring in:
Line 505:
=={{header|Phix}}==
{{trans|Go}}
<!--<
<span style="color: #000080;font-style:italic;">-- demo/rosetta/Ukkonens_Suffix_Tree.exw</span>
<span style="color: #008080;">with</span> <span style="color: #008080;">javascript_semantics</span>
Line 714:
<span style="color: #7060A8;">printf</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">" first %,d d.p. of Pi is: %s (%s)\n"</span><span style="color: #0000FF;">,</span> <span style="color: #0000FF;">{</span><span style="color: #000000;">n</span><span style="color: #0000FF;">,</span><span style="color: #000000;">r</span><span style="color: #0000FF;">,</span><span style="color: #000000;">e</span><span style="color: #0000FF;">})</span>
<span style="color: #008080;">end</span> <span style="color: #008080;">for</span>
<!--</
{{out}}
<pre>
Line 743:
Having done that, the timings for extracting the longest repeated sequence of digits are reasonably quick and fairly linear as expected.
<
import "/dynamic" for Struct
import "/trait" for ByRef
Line 938:
var elapsed = (System.clock - start) * 1000
System.print(" (this took %(elapsed) ms)\n")
}</
{{out}}
|