Popular Python recipes tagged "kth"http://code.activestate.com/recipes/langs/python/tags/kth/2013-07-15T14:34:07-07:00ActiveState Code Recipeskth compsite number (Python)
2013-07-15T14:34:07-07:00Captain DeadBoneshttp://code.activestate.com/recipes/users/4184772/http://code.activestate.com/recipes/578607-kth-compsite-number/
<p style="color: grey">
Python
recipe 578607
by <a href="/recipes/users/4184772/">Captain DeadBones</a>
(<a href="/recipes/tags/kth/">kth</a>, <a href="/recipes/tags/numbers/">numbers</a>, <a href="/recipes/tags/python/">python</a>).
</p>
<p>Found this Interview question. Here is my solution to it.</p>
<p>Assume f(x,y,z) = a^x * b^y * c^z</p>
<p>The x, y and z are integers larger than or equal to zero. Find the kth number in the series this function produces.</p>
<p>Check out my blog <a href="http://thelivingpearl.com/">Captain DeadBones Chronicles</a></p>
Search nth smallest element in really big file (Python)
2010-11-30T17:38:38-08:00Teodor Kichatovhttp://code.activestate.com/recipes/users/4176095/http://code.activestate.com/recipes/577478-search-nth-smallest-element-in-really-big-file/
<p style="color: grey">
Python
recipe 577478
by <a href="/recipes/users/4176095/">Teodor Kichatov</a>
(<a href="/recipes/tags/big/">big</a>, <a href="/recipes/tags/file/">file</a>, <a href="/recipes/tags/kth/">kth</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/search/">search</a>, <a href="/recipes/tags/selection/">selection</a>, <a href="/recipes/tags/smallest/">smallest</a>).
</p>
<p>Search nth smallest float in really big file (more, more and more bigger than available RAM)
in a single pass through the file</p>
<p>if your file more than 150GB - you should use a more appropriate sampling params to the data
more - you can use tempfile to store data(interval) returned from func fill_interval
data:
file with only one float number per line, good shuffled</p>