How to calculate the index (lexicographical order) when the combination is given
问题 I know that there is an algorithm that permits, given a combination of number (no repetitions, no order), calculates the index of the lexicographic order. It would be very useful for my application to speedup things... For example: combination(10, 5) 1 - 1 2 3 4 5 2 - 1 2 3 4 6 3 - 1 2 3 4 7 .... 251 - 5 7 8 9 10 252 - 6 7 8 9 10 I need that the algorithm returns the index of the given combination. es: index( 2, 5, 7, 8, 10 ) --> index EDIT: actually I\'m using a java application that