When sorting or creating sorted collections, you can always specify your own instance of the object's Comparator. That way you can alter the ordering of objects.

string,order,punctuation,lexicographic

Looking at ASCII values, '.' (ASCII 46) comes before 'm' (ASCII 109). This works for comparing basic punctuation to letters, however you should remember that in ASCII capital 'Z' comes before lowercase 'a'. UTS #10: Unicode Collation Algorithm covers comparing strings that contain punctuation. This report is the specification of...

algorithm,permutation,discrete-mathematics,lexicographic

You can do it this way: // n is the number of elements in the given sequence p = all permutations of [0, 1, ..., n - 1] in lexicographical order for permutation in p: for i = 0 ... n - 1 print(s[permutation[i]]) // s is the given sequence...

Have you considered using sortrows? Should enable you to straight-forward sort your 3-columns of data lexicographically.

python,algorithm,permutation,bitmask,lexicographic

You should make the bitmask bit 0 again by adding the line: bitmask ^= 1<<i Code: def permutations(): global running global characters global bitmask if len(running) == len(characters): print(''.join(running)) else: for i in xrange(len(characters)): if ((bitmask>>i)&1) == 0: bitmask |= 1<<i running.append(characters[i]) permutations() bitmask ^= 1<<i #make the bit zero...

c++,string,combinations,powerset,lexicographic

This is a simple recursive approach: #include <string> #include <iostream> using namespace std; void get( string str, string res ) { cout << res << endl; for( int i = 0; i < str.length(); i++ ) get( string(str).erase(i,1), res + str[i] ); } int main( int argc, char **argv) {...

Don't know how to stablish a dynamic string[] length, letting the user establish the string[].length It is not necessary to do that. But here's how. Approach #1: ask the user to give you a number and then allocate the array like this: String[] strings = new String[theNumber]; Warning: the...