Author |
Topic: beginner qn - algorithm to simplify a fraction (Read 814 times) |
|
Valerfore
Guest
|
|
beginner qn - algorithm to simplify a fraction
« on: Aug 26th, 2004, 1:15am » |
Quote Modify
Remove
|
Hi all I hope this question doesnt insult your intelligence given a fraction, say 6/12, how do you simplify it to its simplest term, 1/2? Im a beginner cs student so would appreciate your help!
|
|
IP Logged |
|
|
|
towr
wu::riddles Moderator Uberpuzzler
Some people are average, some are just mean.
Gender:
Posts: 13730
|
|
Re: beginner qn - algorithm to simplify a fraction
« Reply #1 on: Aug 26th, 2004, 1:33am » |
Quote Modify
|
::divide both sides by their greatest common divisor I think Euclid had a nice algorithm to find it.. ::
|
« Last Edit: Aug 26th, 2004, 1:35am by towr » |
IP Logged |
Wikipedia, Google, Mathworld, Integer sequence DB
|
|
|
John_Gaughan
Uberpuzzler
Behold, the power of cheese!
Gender:
Posts: 767
|
|
Re: beginner qn - algorithm to simplify a fraction
« Reply #2 on: Sep 7th, 2004, 8:13am » |
Quote Modify
|
Can you find an algorithm that has a faster theta or omega time (not necessarily O()) than the one towr mentioned? There are algorithms that are faster in certain circumstances...
|
|
IP Logged |
x = (0x2B | ~0x2B) x == the_question
|
|
|
|