-
-
Notifications
You must be signed in to change notification settings - Fork 46.8k
Divide and Conquer #1308
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
Divide and Conquer #1308
Conversation
maths/find_max_recursion.py
Outdated
:param nums: contains elements | ||
:param left: index of first element | ||
:param right: index of last element | ||
:return: min in nums |
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.
:return: says min but should say max.
Also, add doctests as discussed in CONTRIBUTING.md
>>> nums = [1, 3, 5, 7, 9, 2, 4, 6, 8, 10]
>>> find_max(nums, 0, len(nums) - 1) = max(nums)
True
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.
Updated, Thanks for your review! @cclauss
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.
Both files need doctests like the one above.
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.
Please review again! @cclauss
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.
:return: says min but should say max.
Also, add doctests as discussed in CONTRIBUTING.md
>>> nums = [1, 3, 5, 7, 9, 2, 4, 6, 8, 10] >>> find_max(nums, 0, len(nums) - 1) = max(nums) True
I updated as you say, correct?
maths/find_max_recursion.py
Outdated
:param right: index of last element | ||
:return: max in nums | ||
|
||
>>find_max([1, 3, 5, 7, 9, 2, 4, 6, 8, 10], 0, 9) == 10 |
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.
greater than >, greater than >, greater than >, space
If not, it is not recognizing as a test.
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.
you mean like this nums = [9, 7, 5, 3, 2, 1]
?
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.
Nope. I mean:
>>> find_max(...
# not...
>>find_max(...
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.
So that your tests appear here https://travis-ci.org/TheAlgorithms/Python/builds/595103352#L382
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.
Thanks, I corrected follow as you say.
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.
Please review again! @cclauss
Please review again @cclauss |
maths/find_max_recursion.py
Outdated
:return: max in nums | ||
""" | ||
|
||
""" |
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 lines 9 and 11.
:param right: index of last element | ||
:return: min in nums | ||
""" | ||
|
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 lines 9 and 11.
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.
Is this change done?
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.
Yes!Done
Please review again! @cclauss |
@cclauss Did you forget review?😹 |
Thanks for your persistence!
Find max and min value using Divide and Conquer algorithms