I search the most efficient way to get the difference between two arrays of arrays. At this point I don't know if working with hash would be better.
I have two arrays of array containing one id and one datetime converted to int.
a = [[1, 1234],[2, 7345],[3, 12769],[4, 13456], [5, 34765]]
b = [[1, 1234],[3, 12769],[2, 7345],[5, 39875],[4, 13459]]
My goal is to know if the date contained in each arrays of a is superior to the date contained with the same id in b and keep the arrays that match the comparaison otherwise I would have done something like a - b.
What is the fastest and cleanest way even with large amounts of arrays ?
The alternative way would be with hash, I don't really know what to use.
a = [{id: 1, date: 1234},{id: 2, date: 7345},{id: 3, date: 12769},{id: 4, date: 13456},{id: 5, date: 34765}]
b = [{id: 1, date: 1234},{id: 3, date: 12769},{id: 2, date: 7345},{id: 5, date: 39875}, {id: 4, date: 13459}]
What are your thoughts ?
a[i]==b[i]will always be true? If so, that simplifies things a bit.aunchanged couldbequal[[2, 7345],[1, 1234],[3, 12769],[4, 13459], [5, 39875]]?