I encounter a difficult problem in java. I have two dataset or we can say that two arrays. They are x and y coordinates. Whenever this two co ordinates values are match they can extract whole data chunk. Then it again looking for matches. I include a picture with this question
The blue line show the 1st data chunk
The black line show the 2nd data chunk
The red line show the 3rd data chunk.
I develop a algorithm for the problem
Take two loop counter i and k and initialize i=0 and k=1.
2.check if x[i] and y[i] is same with x[k] and y[k] then save x[i],y[i] to x[k],y[k] , increment both counter.
3.If they are not same increment counter k with 1.
if they are not same increment k with 1.
5.If they are same increment counter i by 1 and set k=i+1.
6.Then again check
This is my algorithm. Now my problem is that how could I implement save data portion. Where should I save this chunk of data s. Also we should remember that the chunk are not always same in size. So I need some dynamic data structure.
2ndly what is the technique to compare a pair of data with some other pair or data?
So helpful suggestion of this two problem is most welcome.
Thank you in advance.