the best way is 26 base number system.
 
say: a=0, b=1...
 
so, abab
 
first reverse it: baba
 
so, baba = (1010)_26= 26^0*0 + 26^1*1 + 26^2*0 + 26^3*1 = ?
 
now u may say i assumed a=0 but it should have been a=1.
 
well... why dont u just add: 1 to each position that means, for 4 digit number add: 26^0 + 26^1 + 26^2 + 26^3
 
Mahbub
 


 
On 10/8/06, raja <[EMAIL PROTECTED]> wrote:

The problem is like this:

We represent lexicographic words with digits.

So,
a=1
b=2
c=3
.
.
.
.
z=26
ab=27
ac=28
.
.
.
az=51
bc=52
.
.
.

I am unable to find a general formula for this. It seems that I need as
mane sigma as many number of letters are (means as many for loops). Can
anybody propose a better answer?




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups-beta.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---

Reply via email to