My question is quite simple. I am implementing a greedy algorithm technique over the coefficients of a matrix and selecting the best coefficient according to some criteria. The matrix size is 50x1000. In every iteration a single coefficient is selected for operations. The problem before the initiation of the algorithm is out of 50,000 coefficients I have 25,000 candidate coefficients which I should process. Now in the first iteration I have to select the best coefficient among the 25,000 and in the successive iterations I have to select one from 24999, 24998, 24997. So as you see, the algorithm is quite time consuming because in each iteration I have to calculate the benefit of all the coefficients and select the best one according to the benefit and this benefit processing is a further matrix operation which is also time consuming. Do you have any idea how to reduce the computation time of the algorithm? My implementation language is java. Any help or ideas are appreciated.