- #1

jd12345

- 256

- 2

Is that the right practice?

You are using an out of date browser. It may not display this or other websites correctly.

You should upgrade or use an alternative browser.

You should upgrade or use an alternative browser.

- Thread starter jd12345
- Start date

- #1

jd12345

- 256

- 2

Is that the right practice?

- #2

Mark44

Mentor

- 36,656

- 8,655

That's what programming

Is that the right practice?

- #3

jd12345

- 256

- 2

Also some questions like finding gcd of two numbers- humans factorise the two numbers and multiply the common factors but for the computers we use euclid's algorithm. Why the different approaches?

- #4

ImaLooser

- 489

- 3

Is that the right practice?

Yeah, that is pretty much the idea. Most computer programs are very routine logic, just done much faster than a human can do.

I would add that most humans do a rather sloppy job with logic, this reflected in the poor quality of the average computer program. So try to do better than that, if you can. The main problem is that humans tend not to consider unusual cases and get a program that crashes whenever you do anything out of the ordinary.

- #5

Borek

Mentor

- 29,167

- 3,837

Also some questions like finding gcd of two numbers- humans factorise the two numbers and multiply the common factors but for the computers we use euclid's algorithm. Why the different approaches?

Nobody ever prohibited humans from using Euclid algorithm nor computers from factorizing and multiplying common factors.

Method with common factors is rather difficult to code - way more operations to do (preparing list of prime factors, managing two sets of factors, finding the intersection). Euclid algorithm is much more elegant. No idea why Euclid algorithm is not taught in schools as a method; perhaps for pedagogical reasons.

- #6

pantaz

- 587

- 2

That has some pretty wide-ranging possibilities... I am just telling the computer what humans would do to solve that problem.

Easier to answer if you would provide a sample of your code.Is that the right practice?

What is your method of learning? (School, on-line courses, "how to" books, ...?)

Share:

- Replies
- 8

- Views
- 710

- Last Post

- Replies
- 7

- Views
- 528

- Replies
- 0

- Views
- 667

- Last Post

- Replies
- 1

- Views
- 329

- Replies
- 2

- Views
- 169

- Replies
- 16

- Views
- 740

- Replies
- 22

- Views
- 919

- Last Post

- Replies
- 1

- Views
- 2K

- Last Post

- Replies
- 8

- Views
- 446

- Replies
- 4

- Views
- 284