Skip to content

Improved the Highest Common Divisor Algorithm #89

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 4 commits into from
Closed

Improved the Highest Common Divisor Algorithm #89

wants to merge 4 commits into from

Conversation

NoOne1007
Copy link

@NoOne1007 NoOne1007 commented Oct 19, 2021

If the two numbers have a huge difference, the algorithm will take too many steps to run. Instead, one can take the remainder and move to the next step directly. It is a considerable improvement in run time.

Also, in the issue, it is mentioned that the Greatest Common Divisor algorithm is missing. But, HCF and GCD are the same, so there should be no need for two different files with the same code. If you still want to have a separate file for Greatest Common Divisor, I can add it.

Would you please review and suggest if any changes are required?
PR for hacktoberfest, please add the label hacktoberfest-accepted.

Instead of taking the difference at every step, one can use the remainder(since it is going to keep running until it reaches the point the value of x is smaller than y).
This pull request was closed.
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.

1 participant