WE CAN USE RADIX SORT TO FIND THE MAX VERSION :TRAVERSING FROM LEFT TO RIGHT (RADIX WILL BE NUMBERS BETWEEN THE POINTS). It will reduce the search space too.
On Tue, Oct 11, 2011 at 1:58 AM, sumit kumar pathak <sumitkp1...@gmail.com>wrote: > * > *regards > - Sumit Kumar Pathak > (Sumit/ Pathak/ SKP ...) > *Smile is only good contagious thing.* > *Spread it*!!!!! > > > > On Tue, Oct 11, 2011 at 11:22 AM, DIPANKAR DUTTA < > dutta.dipanka...@gmail.com> wrote: > >> what's happen if the versions are not in same length.. >> >> For example >> >> v1: 1.1.1.133.2 >> v2: 1.2 >> v3: 1.2.3.4.5555.333 >> v4: 1.2.3.4.5554.222 >> v5: 1.3.2.2.2.2.2.2.2.2.2.2.2.2 >> >> It implies we must be scan from left side one by one ... >> >> In general the we make a some sort of lexical comparison where each >> character is a number and separated by number .. >> >> the problem definition is as : >> >> let V1,V2,V3 ...Vn be the n version >> >> let S={1,2,3...n} ,index=0 >> >> Latest[S,index]= return Vi if { Max(ALL Vi[k] where i belongs to S )} >> is a singleton, else >> = return Latest[ set of all index belongs to { Max(ALL >> Vi[k] where i belongs to S )}, index+1 ] >> >> >> >> >> >> On 10/11/11, Dave <dave_and_da...@juno.com> wrote: >> > @Karen: It is more complicated than scanning character by character. >> > E.g., "1.10.3" is older than "1.9.7". I think >> > > <snip> > >> you need to parse the >> > numbers between the dots and compare them >> > </snip> > > simple, easier and correct way. > points: > - compare left to right (ofcourse) each version being vector of numbers > - for diffrent size, assume extra ones to be zero while comapring (no > need to store trailing zeros) > > > >> 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, "bagaria.ka...@gmail.com" >> > <bagaria.ka...@gmail.com> 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 algogeeks@googlegroups.com. >> > To unsubscribe from this group, send email to >> > algogeeks+unsubscr...@googlegroups.com. >> > For more options, visit this group at >> > http://groups.google.com/group/algogeeks?hl=en. >> > >> > >> >> >> -- >> Thanks and Regards, >> ------------------------------ >> **DIPANKAR DUTTA >> Software Development Engineer >> Xen Server - OpenStack Development Team (DataCenter and Cloud) >> >> Citrix R&D India Pvt Ltd >> 69/3, Millers Road, Bangalore – 560052 >> Phone: +91 8147830733 >> Office: Extn: 16429 >> Email: dipankar.du...@citrix.com >> >> -- >> 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 >> algogeeks+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> >> > -- > 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 > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- ........................ *MOHIT VERMA* -- 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 algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.