1
Reply

array looping

sarath phani

sarath phani

Feb 3 2009 12:42 AM
2.4k

Hi,

I have 2 arrays one is with file widths and other with file names. my problem is i have to compare all width elements in array and group them. for example array looks like {13.1,23,27.7,14.5,13.9,23.9,14.6}, now i have to group this based on elements like { {13.1,13.9},{14.5,14.6},{23,23.9},27.7}}. after that base for each group will be max element, {{13.9,13.9},{14.6,14.6},{23.9,23.9},27.7}}. now i have to check one group with other if difference is less than 2, then make max element aas base. i.e {{14.6,14.6,14.6,14.6},{23.9,23.9},27.7}} bcos 14.6-13.9 = 0.7 which is less than 2. like that i have to loop all till end.

please help me in this. Thanks in advance.


Answers (1)