问题
I am finding longest substring in text T, such that it is a prefix of string S. I have made algorithm using suffix tree which provides less complex solution, but since Matlab doesn't use pointers or any other reference, I am stuck at the implementation.
Could somebody please suggest some solution or some alternate way to this problem, possible in Matlab.
回答1:
Here are a few suggestions for using "pointers" in Matlab:
- You can simply use cell array indexes as pointers, to reference cell array elements. This is probably the simplest approach.
- You can use a Handle Class for creating classes which you can hold references to. A little more involved but very nice from a software engineering point of view.
- As less Matlaby solution, you could write the algorithm in C and use mex to interface between Matlab and your algorithm.
来源:https://stackoverflow.com/questions/15517520/suffix-tree-in-matlab