Hi guys i just want to know if it is possible to find the rank of a string. Is it possible?
Given a word all the letters of it are permuted in all possible ways and thus formed words are arranged as in a dictionary. Then the position of the given word is simply called rank of the word. Procedure to find the rank of a word Step 1: Write the word and above it,put the alphabetical ordering. Step 2:Write below,the factorial values starting with 0!(=1) from right to left. Step 3:Write the number of numbers less than(in top row) the number towards right of it. Step 4:Multiply the numbers shown by and add. Step 5:Add "1" to get the rank of the word. Example: The rank of the word "MASTER" is Step 1: 3 1 5 6 2 4 M A S T E R Step 2: 120 24 6 2 1 1 Step 3: 2 0 2 2 0 0 Step 4: 240+0+12+4+0+0=256 Step 5: 256+1=257 Therefore 257 is the rank of the word "MASTER"