Skip to content

fixed the merge implementation in MergeSort #579

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

Closed
wants to merge 1 commit into from
Closed

fixed the merge implementation in MergeSort #579

wants to merge 1 commit into from

Conversation

guyariely
Copy link

In order to achieve n*log(n) time complexity, MergeSort relies on the merge function running in linear time.
Currently it runs on n^2 because of the use of the shift function.

@lgtm-com
Copy link

lgtm-com bot commented Mar 17, 2021

This pull request introduces 3 alerts when merging 39a1131 into fb9ad3b - view on LGTM.com

new alerts:

  • 3 for Missing variable declaration

function merge (list1, list2) {
var results = []
function merge(list1, list2) {
results = Array(list1.length + list2.length);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- results = Array(list1.length + list2.length);
+ const results = Array(list1.length + list2.length);

Make sure to use standard to format the file as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants