[fpc-devel] Re: enumerators

Alexander Klenin klenin at gmail.com
Mon Nov 15 17:29:18 CET 2010


On Tue, Nov 16, 2010 at 01:50, Hans-Peter Diettrich
<DrDiettrich1 at aol.com> wrote:
>> The other of the algorithm is then still O(n^2), since UTF8Char will
>> already be O(n)?
>
> The total order will be something between O(n^1) and O(n^2), depending on
> many factors (what is "n"?...).

Huh? O(f(n)) has a precise definition, and of course we are talking worst-case
complexity here (although average complexity would be the same in this case).
n is the string length, measured in whatever units you choose.

> I also doubt that UTF8char is a reasonable type for the loop variable - IMO
> UTF32char were a much better choice...

I think I meant exactly the same thing (an integer holding the codepoint value),
but just named the type carelessly. In fact, I think the best name would be
something like "UnicodeChar" or even "Codepoint", to avoid association
with any particular encoding.

-- 
Alexander S. Klenin



More information about the fpc-devel mailing list