Why you should learn algorithms even as a non-programmer

var gcd = function(a, b) {  
if (!b) {
return a;
}

return gcd(b, a % b);
};
  • If A = 0 then GCD(A,B)=B, since the GCD(0,B)=B, and we can stop.
  • If B = 0 then GCD(A,B)=A, since the GCD(A,0)=A, and we can stop.
  • Write A in quotient remainder form (A = B⋅Q + R)
  • Find GCD(B,R) using the Euclidean Algorithm since GCD(A,B) = GCD(B,R)

Keep it simple and short:

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Setting up an SSL on AWS EC2 with Amazon Linux 2 — [A.N.T.S]

How to root hitech Air A7

Root LG Phone

Development of the time and Space Clock

We Made It! We Released the App!

Connectivity Checker (Shellmates)— Write-up.

Cast directly from your Oculus Quest to MacBook

Why I Fell in Love With Web Development

Mocking Mongoose to test API’s with Jest

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Tianying Jiang

Tianying Jiang

More from Medium

10+ Topics to prepare for Competitive Programming

How to check if a given number is prime or not [python]

#100DaysofCode — Day[1](2)

A Quick Guide to Linked Lists