Timeline for Calculating GCD for 2 integers
Current License: CC BY-SA 3.0
11 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Feb 12, 2018 at 22:50 | history | edited | Tristan Gibson | CC BY-SA 3.0 |
Removed else.
|
Aug 21, 2017 at 8:28 | comment | added | Vogel612 |
the second recursive suggestion would benefit a lot from dropping the unnecessary else
|
|
Aug 20, 2017 at 11:42 | comment | added | Tristan Gibson | @greybeard You are correct, the IL produced is (probably) exactly the same. Upon verifying this, it is stated that "stack space for local variables is usually allocated in the function scope." There would be no overhead and the benefit of declaring within the scope would be readability and convenience. Thank you for correcting me; it's indeed a misconception I had. | |
Aug 20, 2017 at 11:39 | history | edited | Tristan Gibson | CC BY-SA 3.0 |
Corrected myself on scoping variables. Adjusted it so my answer is on top, crediting other answers for iterative method.
|
Aug 20, 2017 at 8:30 | comment | added | greybeard |
no need to create tmp every iteration - kidding? "Creating" an instance of a value type is no effort, if not a misconception. Keeping scopes as small as possible is a virtue.
|
|
Aug 19, 2017 at 23:32 | history | edited | Tristan Gibson | CC BY-SA 3.0 |
Added benchmark and iterative method.
|
Aug 19, 2017 at 23:26 | history | edited | Tristan Gibson | CC BY-SA 3.0 |
Added benchmark and iterative method.
|
Aug 19, 2017 at 22:39 | history | edited | Tristan Gibson | CC BY-SA 3.0 |
Formatted.
|
Aug 19, 2017 at 19:45 | vote | accept | Gustaf | ||
Aug 19, 2017 at 19:47 | |||||
Aug 19, 2017 at 19:18 | history | edited | Tristan Gibson | CC BY-SA 3.0 |
added 105 characters in body
|
Aug 19, 2017 at 19:12 | history | answered | Tristan Gibson | CC BY-SA 3.0 |