Member since 05/23/2011

5 snippets

955 profile views

0 Comment(s) Posted

View their favorites

their Tags



first submission:submitting first snipplet

rtperson's Recent Snippets

« Prev 1 Next »
Really DP-lite. Memoize the solution for a recursive problem so it can be looked up on subsequent iterations.
0 688 posted 8 years ago by rtperson
You have to use float or double for the returned value, since the scale occurs in a continuous function.
0 582 posted 9 years ago by rtperson
It's no fun implementing QuickSort unless you can force it out of its blister-fast, O(n log n) speed and humiliate it with its worst-case, O(n^2) runtime. So that's what I set out to do. My naive partition simply pivots around the low item, but...
0 340 posted 9 years ago by rtperson
Two versions of binary search -- one recursive, one iterative -- for an array of strings. Both assume that your array index fits within an integer.
0 411 posted 9 years ago by rtperson
Check that a given integer consists only of elements of a given set. It does a linear search through the set, so the assumption is that the set to search is relatively small. If you're chewing through a particularly large set of digits, you may want...
0 335 posted 10 years ago by rtperson
« Prev 1 Next »