Description
During reading the changes made by PR #188, I encountered some paragraph in the linked-list.md
, which I do find is giving a suspicious alternative for implementing the exercise in functional languages:
In languages that do not have good support for mutability (such as Elixir or Erlang), you may choose to implement a functional list where shift and pop have amortized O(1) time. The simplest data structure for this will have a pair of linked lists for the front and back, where iteration order is front ++ reverse back.
In a commit of the afforementioned PR, I already did a quick comment:
So this paragraph is describing an Okasaki-Functional-Double-Ended-Queue. This is not comparable with Doubly-Linked-Lists in any way.
Perhaps we should split this exercise up into this one and describe it in a imperativ way only while creating another exercise which does require you to implement a dequeue.
Another way to interprete this paragraph is very similar to a zipper as in zipper.md. If it is meant like a zipper we should probably don't do this exercise in languages which are immutable only and stick to that zipper-exercise.
Are there any further opinions on this?