help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [External] : Use of an associated list with completing-read


From: Emanuel Berg
Subject: Re: [External] : Use of an associated list with completing-read
Date: Sat, 20 Apr 2024 03:59:20 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Stefan Monnier via Users list for the GNU Emacs text editor wrote:

>> An even more common cliche for doing the same thing is to
>> do #1, then (2) cons instead of append, and (3) when
>> finished adding list elements, do an `nreverse' of the list
>> you created. That too is a destructive operation.
>
> That's the usual solution, with the desired linear (i.e.
> optimal) complexity, indeed.

AKA O(N) which is linear, or proportional to the problem
size N.

Even better is constant complexity, O(1), where it does not
matter how big the problem is, since that, N, isn't even in
the equation, as we saw.

Probably not possible in a lot of cases, including this one.

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

[Prev in Thread] Current Thread [Next in Thread]