[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Easy to add with push but not to the end of a list
From: |
Emanuel Berg |
Subject: |
Re: Easy to add with push but not to the end of a list |
Date: |
Wed, 30 Nov 2022 17:12:56 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
tomas wrote:
>>> Add them in the reverse order and finish with a simple
>>> `reverse`. That's a very standard design pattern with
>>> singly-linked lists (and in many/most cases the final
>>> `reverse` can be an `nreverse`).
>>
>> I thought about `nreverse' but if that changes all the CDRs
>> then that's linear as well i.e. O(n), otherwise you could
>> do nreverse, `push', and nreverse again ...
>
> The pattern is push, push, push, push... nreverse.
And the `push' after that?
--
underground experts united
https://dataswamp.org/~incal
- Re: Easy to add with push but not to the end of a list,
Emanuel Berg <=
- Re: Easy to add with push but not to the end of a list, Emanuel Berg, 2022/12/01
- Re: Easy to add with push but not to the end of a list, Michael Heerdegen, 2022/12/01
- Re: Easy to add with push but not to the end of a list, Emanuel Berg, 2022/12/03
- Re: Easy to add with push but not to the end of a list, Michael Heerdegen, 2022/12/03
- Re: Easy to add with push but not to the end of a list, Emanuel Berg, 2022/12/05
- Re: Easy to add with push but not to the end of a list, Michael Heerdegen, 2022/12/05
- Re: Easy to add with push but not to the end of a list, Emanuel Berg, 2022/12/05
- Re: Easy to add with push but not to the end of a list, Michael Heerdegen, 2022/12/05
- Re: Easy to add with push but not to the end of a list, Emanuel Berg, 2022/12/06
- Re: Easy to add with push but not to the end of a list, Michael Heerdegen, 2022/12/06