Skip to content

fixed the merge implementation in MergeSort#579

Closed
guyariely wants to merge 1 commit intoTheAlgorithms:masterfrom
guyariely:master
Closed

fixed the merge implementation in MergeSort#579
guyariely wants to merge 1 commit intoTheAlgorithms:masterfrom
guyariely:master

Conversation

@guyariely
Copy link
Copy Markdown

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
Copy Markdown

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
Copy Markdown
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