-
Notifications
You must be signed in to change notification settings - Fork 137
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
Is there any functions for sorted list? #182
Comments
I don't think so. We can add Do you want to try to write a patch? (or anyone else? Otherwise I'll put it on my queue later this week) |
Something like this?
|
Thanks! A couple notes though:
I think something like using In general, dash guidelines are "clarity over speed" until someone complains it's too slow. |
I am not sure whether a binary search is beneficial. Binary search through link list : iteration is O(n) with comparison O(log n). Linear scan: iteration is O(n) with comparison O(n). I think there may be benefit when list is long or comparison is not a simple comparison, say comparing a string entry in a structure with case ignored or even string-lessp is not simple. |
Right, but isn't your code binary search? Or we're misunderstanding each other. |
Yeah binary search is still good when list is long or comparison is not a simple comparison. When list is short, it doesn't matter what method we use. Anyway, I leave the job for you. 😝 Finally, thanks for this awesome library, many other awesome packages can happen. |
Like inserting an element in a sorted list and returns the new sorted list
or
combining two sorted list and returns a new sorted list?
The text was updated successfully, but these errors were encountered: