-
-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Linked List insertion, remove and reordering #170
Comments
Hello @jramstedt, this is true indeed but I must admit I did not implement this out of laziness since I never had a legitimate use case for linked list in javascript that was not counterproductive, performance-wise. This is not to say that you don't have a legitimate use-case, it's just I don't implement things that are not used. Would this be useful to you? Can you explain your use case to me? I have a prototype of a way to implement a very efficient linked-list in JavaScript if you can guarantee that you know the maximum number of elements you will need for instance, but I never industrialized it for lack of a reason to do so. |
Uses for single linked list are few. Double linked list is more useful in general and would like to see that implemented here too. I use BiMaps from this library already and had need for linked list. I did find another package, that I'm currently using, but that isn't perfect for my use either. |
Hello @jramstedt, I know the typical use cases for linked lists. My point is that, often, linked lists in JavaScript are not worth it performance-wise, even against inferior O(n) algorithms relying on flat arrays. So I have some questions: 1. how many items are we speaking of? 2. have you tried benchmarking suboptimal linear algorithms against the linked list solution you are using and 3. in your use case, do you always know the upper bound for the max number of items your list may need to store? Then, if you want we can discuss the addition of an especially performant implementation of a doubly-linked list that could suit your use-case. |
There is no way to insert new values between values, remove values or move (reorder) values in the list.
Currently there is no benefit of using linked list instead of array.
The text was updated successfully, but these errors were encountered: