Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Finding an arbitrary element of the m-th k-subset in polynomial time

$
0
0
Hello Dream.in.code,

I was wondering if one of you could help me with a problem. I want to know if there's a polynomial time algorithm to solve the following problem:

Given integers n, k, r, and c where r<k and c<(n+1 choose k), what is the (r+1)-th-smallest member of the c-th k-subset of integers from 0 to n?

I'm already quite familiar with a few variations on an algorithm that returns k-subsets as a function of integers without needing to generate any lower-indexed subsets (this is called an "unranking" algorithm, and a good explanation of one is given here): http://msdn.microsoft.com/en-us/library/aa289166(v=vs.71).aspx

And some useful additional reading can be found here: http://en.wikipedia.org/wiki/Combinatorial_number_system

The problem is, the value of k increases exponentially with the size of its representation, and the algorithm above, and all variations on it with which I am familiar, require that the individual elements within the k-subset be generated in some order, whether largest to smallest or vice-versa. Therefore, in the worst-case scenario, it will take exponential time to reach some arbitrary element within the k-subset. The above algorithm, however, was designed to generate entire k-subsets, not just specific elements therein, and therefore I yet have hope that another, polynomial-time algorithm exists that would accomplish my intended goal.

And yes, before you ask, I have looked through all the textbooks and reference materials I can find, and not one of them even mentions the problem I have given above--which I find rather shocking, but there you have it.

I kindly ask that nobody reply who has not read this post in its entirety, and understood it. I have asked the same question of many people, including people who ought to have known better, who simply replied with something along the lines of, "Here's an algorithm for generating an arbitrary k-subset!" Again, as noted above, all such algorithms I know of take EXPONENTIAL TIME (and that's bad), because they require that the individual elements of that k-subset be generated in a certain order. I have had people reply, "No, this method doesn't require that the previous k-subset already be known," but that's not the problem. I do not need another algorithm that generates a k-subset from an integer index; I need an algorithm that finds the (r+1)-th smallest integer in that k-subset without needing to know the r-th smallest or the (r+2)-th smallest integer in that k-subset.

If you don't know whether the above problem can be solved in polynomial time, but do know whether it belongs in complexity class PH, that would be helpful too.

And I'm very sorry if I come off as snippy, but I've been working on a personal project (a paper I want to submit for publication) for a long time, and the lack of a solution to this problem means that I can't finish it. (I've become extremely frustrated.)

Anyone who can help would be my hero. Thanks.

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>