[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [External] : Re: Easy to add with push but not to the end of a list
From: |
Drew Adams |
Subject: |
RE: [External] : Re: Easy to add with push but not to the end of a list |
Date: |
Wed, 30 Nov 2022 18:17:03 +0000 |
> In addition to what has already been said: if you store and update the
> last cdr of your list (in a variable for example), you can add something
> to the end of the list in O(1). The cost is the cost of maintaining
> additional data.
Yes, I mentioned that too:
(Or else you have to have saved a reference to
that last cons or its cdr. In that case you
can get there directly.)