In this note we propose a new algorithm for checking whether two counting functions on a free monoid $M_r$ of rank $r$ are equivalent modulo a bounded function. The previously known algorithm has time complexity $O(n)$ for all ranks $r>2$, however in case $r=2$ it was estimated only as $O(n^2)$. Here we apply a new approach, based on explicit basis expansion and weighted rectangles summation, which allows us to construct a much simpler algorithm with time complexity $O(n)$ for any $r\geq 2$.
翻译:本文提出了一种新的算法,用于检验秩为r的自由幺半群$M_r$上的两个计数函数模有界函数是否等价。已知的算法在所有秩$r>2$的情况下时间复杂度为$O(n)$,但在$r=2$时其复杂度仅估计为$O(n^2)$。本文采用一种基于显式基展开与加权矩形求和的新方法,从而能够构建一种更简单的算法,对于任意$r\geq 2$,其时间复杂度均为$O(n)$。