Member since 05/23/2011

5 snippets

387 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 233 posted 7 years ago by rtperson
You have to use float or double for the returned value, since the scale occurs in a continuous function.
0 202 posted 8 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 139 posted 8 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 157 posted 8 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 116 posted 9 years ago by rtperson
« Prev 1 Next »