>>>
Thanks to all (Dragan, Marcia and Tore). I wonder which solution is the fastest?>>>
>>>Since you have all the code, why don't you test all the solutions and let us know?
>>
>>(Edit: This reply is for Yossi)
>>
>>I think Dranag's solution is the fastest and optimal, because analyze the string only once and using the minimal instruction set.
>>
>Imagine tcBig 650KB long with 10000 "A": the check will be done 10000 times,
>If the "A" is at the end of the resulting string, will take longer ;-)))
You are right, and I didn't saw Marcia's algorithm that is excelent!
This is the testing results of the 3 algorithms in my PC with a 50000 chars string:
- Dragan: 52.5 secs and maintain the original order
- Tore: 30.9 secs and doesn't maintain original order (order is alphabetical because SQL)
- Marcia: 1.4 secs and maintain the original order => WINNER!
Congrats Marcia! :D
Fernando D. Bozzo
Madrid / Spain