[erlang-questions] re moving nth element from a list

Jesper Louis Andersen <>
Tue Jun 24 16:51:12 CEST 2008


On Tue, Jun 24, 2008 at 4:40 PM, anupamk <> wrote:
>
> hi all,
>
> can you please let me know what would be a more efficient approach to
> removing nth element from a list.

If your list is rather small, say N < 20, then I would suggest you use
something along the
lines of your first implementation. If your list is extremely big and
performance matters, then
I suggest you look for another data structure. With a list there is
only so much you can do: You
have to dig into the list in order to get to the Nth element and that
will cost you O(n).



More information about the erlang-questions mailing list