dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
either - when first table is sorted
- as you loop thru your first table
- check if the destination is the same
- if unequal increment the index on the second table and make a move, then increment the index on the first table
- if equal increment the first index
- when first table is unsorted
- loop thru first table with an inner loop on your second looking for equals (or SEARCH)
- if equal increment first index
- if unequal and end of second table
- increment second index
- make move
- increment first index
- start inner loop again
obviously the sorted first table would make the population of the second more effecient.
but, it takes resources to insure the first table is sorted.
If you have less than a few hundred I would not bother to have a sorted first table. other than that, I have no idea where the break-even point is concerning sorted/unsorted. |
|