-
Notifications
You must be signed in to change notification settings - Fork 308
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
Added Median of Medians method of finding median #33
Conversation
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.
Code seems perfect.
Can you just provide a comment at the end of the program about the complexity of this algorithm?
Should I explain why the complexity is O(n) or just mentioning the complexity would suffice? |
@h-sinha It would be nice if you could write a brief explanation. |
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.
Add an explanation for choosing sublists of 5. Why didn't you use 4 or 6? Give an explanation for how you arrived at the time complexity, that's the main purpose of solving this problem.
I have added the complexity and related explanation @sahilbansal17 @ramitsawhney27 |
else | ||
{ | ||
//as size of median array is large find median of medians | ||
pivot = findmedian(median, partition, partition/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.
@h-sinha This call would not work since you have renamed the function. Please run your program and make changes.
@sahilbansal17 updated |
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.
Did you just commit the a.out file? Remove it using git rm
and commit.
It was removed in the last commit |
|
||
#include<bits/stdc++.h> | ||
using namespace std; | ||
#define sz(a) int(a.size()) |
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.
remove these define statements.
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.
@arnav-mandal1234 updated
@ramitsawhney27 @arnav-mandal1234 I have approved this PR. Please review it once. |
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.
Solve the recurrence, preferably not by substitution and show how you arrived at O(n).
@ramitsawhney27 Is it fine now? |
@ramitsawhney27 Please check this PR. |
Fixes #11 Median Finding