Skip to content

Added article on Euclid's algorithm #129

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

Merged
merged 12 commits into from
Jan 13, 2017
Merged

Added article on Euclid's algorithm #129

merged 12 commits into from
Jan 13, 2017

Conversation

nalinbhardwaj
Copy link

I have translated and added the article on Euclid's algorithm. There are a number of images which have been put in the img directory as well. A link to a straightforward GCD and LCM calculation problem has been added at bottom. The page has also been added to the index. Let me know if any more work is needed :)

Nalin Bhardwaj added 10 commits October 4, 2016 14:39
added new line to correct formatting of main page.
Intial version.
Updated formatting, grammar etc.
Copied images from emaxx.ru
Updated image links to root
Added basic problem and updated link in index.
@nalinbhardwaj
Copy link
Author

@RodionGork @tcNickolas Is there any issue/change required? Why is this not being merged?

@tcNickolas
Copy link
Member

Sorry for the delay, but this project has only two maintainers, who are both busy people and struggle to carve out some time for reviews. I'm reviewing it now

Copy link
Member

@tcNickolas tcNickolas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've done a pass and left major comments. There are a bunch of smaller language and punctuation issues which I can clean up after this pull request is merged.


Given two non-negative integers $a$ and $b$, we require the greater common divisor i.e. the largest number which is a divisor of $a$ and $b$ simultaneously. It's common denoted by $gcd$.

![Euclid’s formula](&imgroot&/euclid1.png)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use formulas instead of images.

```cpp
int gcd (int a, int b) {
while (b) {
a %= b;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix indentation on lines 47 and 48


For the proof of correctness, we need to show $gcd(a, b) = gcd(b, a\mod b)$ for all $a \geq 0$, $b > 0$.

We will show that the quantity on the left side of the equation, can be written as the value on the left. Obviously, this would mean that the left and right sides are the same and prove Euclid's algorithm.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the original text, the proof shows that the expression of the left side of the equation divides the expression on the right side and vise versa. Let's keep this meaning.


- Thomas Cormen, Charles Leiserson, Ronald Rivest, Clifford Stein. Algorithms: Construction and analysis [2005]

## Problems
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the same format as other articles "## Practice Problems"


- [GCD and LCM[easy]](https://www.codechef.com/problems/FLOW016)

####Note: Translated by [NibNalin](http://codeforces.com/profile/NibNalin)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per https://e-maxx-eng.appspot.com/contrib.html, we've agreed to track authorship of pages not with sole author but using Github edits history. Let's remove this line. You can add link to your CF profile in your Github profile if you want to preserve your CF persona.

@nalinbhardwaj
Copy link
Author

@tcNickolas Please review. I have corrected whatever you requested. Let me know in case of anything else. I have tried to not let errors creep in this time. :)

@tcNickolas
Copy link
Member

Thanks for finishing this pull request! Nice work on the formulas :-)

@tcNickolas tcNickolas merged commit e85d87b into cp-algorithms:master Jan 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants