In context of the real开发者_如何转开发ization of a project I need to find the k-longest sequences in PHP. There are many ways to implement this - but which algorithm is the fastest for PHP?
Which algorithm would you implement? (overview)
Which one is most-efficient and dynamic (numbers, strings, etc)? (fast?, time for n-elems?)
How would you implement it? (example)
Thank you!
Post Scriptum
I'm about to implement the ONISI k-nearest neightbour algorithm. The longest sequences are visualised in this schematic.
This shematic gives a brief overview on the ONISI algorithm.The total/immediate-history-elements are strings representing a $state --> $action pattern.
This means, considering the first 3 elements of schematic (1), data would be displayed, for instance, like: $immediate_history = array( array( "s2" => "a2" ), array( "s3" => "a3" ), array( "s1" => "a1" ) [..] );
Still any questions about the problematic?
Cheers!
Which algorithm would you implement? (overview)
KNN is a special case of a variable-bandwidth, kernel density "balloon" estimator with a uniform kernel
Which one is most-efficient and dynamic (numbers, strings, etc)? (fast?, time for n-elems?)
I depends on your data structure. An array is defnetly slower. But use of better and advanced structure will speed things up.
How would you implement it? (example)
I highly doubt anyone will give you this here as the program is not a small one. You have to do this on your own.
精彩评论