I am trying to find an algorithm with, possibly, an example in C, C ++, C #, Java, or indeed any language, to help solve the reordering problem that I am facing.
The goal is to take a number of ranges in the file and reorganize the new template, basically moving parts of the data without destroying the integrity of the data. I would prefer to find one that can execute it in place, and use one buffer to exchange or directly move from one place to another. The reorganization process can split ranges into parts if the ranges have the same length and data integrity when they are completed.
As an example, given a set of values:
Length SrcStart Src End Dst Start Dst End 9178 274054 283231 0 9177 274051 0 274050 9178 283228 582929 283229 866157 283229 866157 399208 874397 1273604 866158 1265365 8239 14675709 14683947 1265366 1273604 986980 1273605 2260584 1273605 2260584 602862 2811144 3414005 2260585 2863446 138712 4092072 4230783 2863447 3002158 116210 3414007 3530216 3002159 3118368 550559 2260585 2811143 3118369 3668927 561856 3530217 4092072 3668928 4230783 24319165 4230784 28549948 4230784 28549948 578539 30246149 30824687 28549949 29128487 491856 28549949 29041804 29128488 29620343 593580 29639113 30232692 29620344 30213923 597308 29041805 29639112 30213924 30811231 13456 30232693 30246148 30811232 30824687 633513 31407949 32041461 30824688 31458200 583261 30824688 31407948 31458201 32041461 40117358 32041462 72158819 32041462 72158819
All content in the ranges SrcStart β SrcEnd must be transferred to the range DstStart β DstEnd. Please note that in many cases, moving from a source to a destination will lead to a change in the Destination content, from which you cannot copy from this location anymore, since the original data that was needed was destroyed.
The goal is to move each data segment from SrcStart to DstStart with a length in the first column. Each line corresponding to "End" is simply the beginning plus the length minus one (therefore its actual offset).
I did a lot of research and looked at variable values ββand broke down areas that intersect with other values, as well as with the container in the container exchange area, but they don't seem to cope. So, as a result, this brings me back to my first statement, which I was hoping for, maybe there was an algorithm or some source from which I could learn to help solve this problem, and the general knowledge of the community just seemed to go.
Thanks!