>> I still have doubts about why u say i shouldn't shuffle the set before i erase the half of it.
I'm not saying you should not shuffle. I am asking you a question that you have not yet answered. If you can answer the question, then I can try to give my opinion about whether random_shuffle is a good idea or not. If it is working for you now and you are ok with it, then that is fine. If it is not working for you, then answer this question: "Is it ok that the order of the data inside aSol->selected_columns changes? Are the columns in aSol->selected_columns supposed to be in a specific order?"
Now, for your posted code, it is very hard to read mostly because the indentation is all messed up. It will help you to fix the indentation (if it looks that bad on your editor), and it will help me too.
The only big thing I see wrong in that code is the k[i] = part. You need to re-do that entire equation. I think you implemented the n_covered count correctly. That is good. But you need to figure out how to use that in the calculation of k[i]. You also need to move the calculation of k[i] out of the for (int j = 0... loop, it should be done after you finish calculating n_covered.
Does that make sense? I really think it would have helped if you had tried to follow my suggestions earlier, but I understand that each person does things in their own way. Hopefully this will help you understand the few small changes you have left to do.