Skip to main content
Gabe's user avatar
Gabe's user avatar
Gabe's user avatar
Gabe
  • Member for 13 years, 8 months
  • Last seen more than 3 years ago
awarded
revised
Loading…
Loading…
comment
Optimize custom double.parse()
You'd actually want to store the reciprocal (pow10[i] = 1/p;) so that you're multiplying (fast) instead of dividing (slow).
comment
String compression implementation in C#
BTW, this operation is called run-length encoding (RLE).
Loading…
comment
Generating 1000 random numbers
@Edward: If bias in this situation is a problem, you shouldn't be using rand() in the first place.
answered
Loading…
awarded
comment
Getting all primes between 0 - n
Do you realize that BigInteger is much slower than int and long?
comment
Regex validation for Email Address
@SimonAndréForsberg: Do you have some examples of valid ones not accepted by this regex?
comment
ToString() and AddString() method without using .Net Collections
If you're not going to have a lastNode field, there's no need to even have a Node class -- just store your stringValue directly in ListOfStrings. Also, Id like to see what your ToString() would look like.
comment
Search for a multiword string in a list of strings
It should be noted that this approach only works because the regexes are all mutually exclusive. If you needed it to be multi-word and end in a 'y', for example, this can't be used.
comment
Is it a good practice to put an exception handler in every method?
Also, he'll end up with a stack trace that goes no higher then one function, and he should just do raise instead of raise e.
awarded
comment
Conway's Game of Life in JavaScript
That's a good idea, but you should give some more info on how to actually implement this in JS. It's not something that will be obvious to the OP.
comment
Conway's Game of Life in JavaScript
The jsfiddle link doesn't work in my browser, so I have no idea how you solved anything. You should post the details on this site, with a link solely for reference.
answered
Loading…
awarded
comment
Comparison to infinity when checking if a point is above a line
@retracile: Yes, that's true, but if a slope could be either +Inf or -Inf, you have to do comparisons.