@Karen: It is more complicated than scanning character by character. E.g., "1.10.3" is older than "1.9.7". I think you need to parse the numbers between the dots and compare them one by one. Thus, in the above example, 1 compares equal to 1, so you keep scanning. Then 10 compares greater than 9 so the first string is number of the newer version. I did this many years ago in a csh install script for a unix product.
Dave On Oct 10, 9:52 pm, "[email protected]" <[email protected]> wrote: > Given two strings describing the version of a particular software need to > find the later version. > > For eg. > 1st string = "1.2.4.5" > 2nd string="1.2.3.5" > > 1st string is the later one. > > Can be done using traversing the string and comparing each character one > after the another. Looking for a better solution with lesser complexity. > > -- > Thanks and Regards > > *Karan Bagaria* > *MCA Final Year* > Training and Placement Representative > *NIT Durgapur* -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
