no. you are not wrong. but the algo you are suggesting is utterly inefficient.

supose this case. you are give a valid lexicographic string abcdefghijklmnopqrstwxyz
now according to my algo, it will add all the numbers in the matrix. but according to your also it will start from a. it will see that a != given string, go to b, then go to c ..... until it reaches given string. It will work, but would take a lot of time. wheereas my algo will give you the formula directly (with a cost of O(n^2) space complexity).

did you understand?

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

i think a better algo...but can be used only in languages where there
is provision of conversion of characters into ascii code...
so algo is...
set a variable counter to one
1.copy the string in a string variable
2.take its first & second character from left to right
3.if the ascii code of second character is less then first , delete the
string
4.else move to third character in the string.
5. repeat steps 3 & 4 till the end of string
6. if the string ends replace the string in file by  counter
7. Increment counter.
8 if end of file then exit else move to step1

if anybody thinks i am wrong plzz let me know







--
Rajarshi Chowdhury
M.Tech, CSE
IIT Roorkee
([EMAIL PROTECTED])

http://chowdhuryrajarshi.blogspot.com

"It is not our abilities that show what we truly are ... it is our choices"

Join Dumbledore's Army at http://groups.google.co.in/group/dumbledore
--~--~---------~--~----~------------~-------~--~----~
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