-
-
Notifications
You must be signed in to change notification settings - Fork 628
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
feat: add sort
method to array/fixed-endian-factory
#3298
base: develop
Are you sure you want to change the base?
Conversation
Coverage Report
The above coverage report was generated for the changes in this PR. |
throw new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', compareFcn ) ); | ||
} | ||
buf = this._buffer; | ||
for ( i = 0; i < this._length-1; i++ ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than a hand-rolled sort implementation, just copy to a temporary buffer (e.g., a plain array), use the built-in sort, and then copy back to the original buffer. That will be 2N + N log N
, which is still better than N^2
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I'll update it
@kgryte May you give it one more review? |
Resolves #3156
Description
This pull request:
Related Issues
This pull request:
sort
method toarray/fixed-endian-factory
#3156Questions
Other
No.
Checklist
@stdlib-js/reviewers