Реализации алгоритмов/Алгоритм Ахо — Корасик: различия между версиями

м
<source> -> <syntaxhighlight> (phab:T237267)
 
м (<source> -> <syntaxhighlight> (phab:T237267))
 
 
== C++ ==
<sourcesyntaxhighlight lang="cpp">
# include <iostream>
# include <map>
return 0;
}
</syntaxhighlight>
</source>
 
== Python ==
<sourcesyntaxhighlight lang="python">
# -*- coding: utf-8 -*-
 
root = aho_create_statemachine(patterns)
aho_find_all(s, root, on_occurence)
</syntaxhighlight>
</source>
 
Вывод скрипта:
<sourcesyntaxhighlight lang="python">
At pos 0 found pattern: a
At pos 0 found pattern: ab
At pos 2 found pattern: cba
At pos 4 found pattern: a
</syntaxhighlight>
</source>
 
== Ссылки ==
583

правки