Skip to content

Merge sort best & average case O(n)? #340

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
sfdye opened this issue Sep 13, 2018 · 11 comments
Closed

Merge sort best & average case O(n)? #340

sfdye opened this issue Sep 13, 2018 · 11 comments

Comments

@sfdye
Copy link

sfdye commented Sep 13, 2018

https://github.com/TheAlgorithms/Python/blob/master/README.md#merge
Shouldn't it be O(n log n).

The Java repo is correct though:
https://github.com/TheAlgorithms/Java#merge

@sfdye sfdye changed the title Mergesort best & average case O(n)? Merge sort best & average case O(n)? Sep 13, 2018
@pandyamarut
Copy link

it's O(n log n ) only.

@hasangokdag
Copy link
Contributor

#342 I changed the readme and created a pull request

@vishkothari96
Copy link

It is O(n*log(n)) for best, average and worst case.
Where, n:size of the array under consideration.

@sumitkumar22299
Copy link

Yes! It should be O(n*log(n)) for every case i.e. best case, average case, worst case.

@hasangokdag
Copy link
Contributor

Are you pointing out that there should be a "" between n and log(n)?
like O(n log(n)) vs O(n
log(n))?

In readme file Merge, Quick and Shell is also using one space as multiplication instead of "*". Thats why I also used it that way in the PR.

@sfdye
Copy link
Author

sfdye commented Sep 22, 2018

@hasangokdag No. In the master, best & average are O(n) which are simply incorrect and misleading.

@piyush01123
Copy link
Contributor

Hi @sfdye , @hasangokdag has corrected precisely what you are saying in his commit. Look at his commit: ce3e678
But his PR is still open, please be patient and let the repo owners merge his PR.

@sfdye
Copy link
Author

sfdye commented Sep 22, 2018

@piyush-kgp Yeah I am aware of the PR. It should get high priority as this simple typo could fail someone's interview.

@piyush01123
Copy link
Contributor

Yes. you are right. Just noticed that this thread is 9 days old. Apologies.

@AnshulMalik
Copy link
Member

Thanks @hasangokdag

@sfdye
Copy link
Author

sfdye commented Sep 28, 2018

Finally this is merged. Cheers 👍

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

No branches or pull requests

7 participants