I am developing a python application that basically performs the following task:
Inside, find a list of items, say A
. Go to another list of items, say B
, and for each item B
in the list, B
find the corresponding item A
in A
. There should always be such an element - if there is no match, the program will fail.
Naturally, it seems that this will be a great example of a binary search application in a hash-ordered data structure.
The problem is that the items in lists are complex objects. Suppose that each record, A
or B
by itself, is a list of about 10 vectors (sometimes more and sometimes less) with this form:
vector = [ id, status, px, py, pz ]
where id
and status
are integer values, and px
, py
and pz
are floating point values, so the element may look like this:
aExample = [ [ 2, -1, 0.5, 0.7, 0.9 ],
[ -1, -1, -0.4, -0.6, -0.8 ],
[ 25, 2, 1.1, 1.3, -1.7 ],
[ 24, 2, 1.2, 1.1, 1.6 ],
[ -24, 2, 0.9, 0.8, 2.1 ],
[ 11, 1, 1.2, 1.3, 2.6 ],
[ -11, 1, 1.4, 1.2, 2.4 ],
[ 13, 1, 1.8, 1.6, 2.1 ],
[ -11, 1, 3.2, 0.1, 3.6 ] ]
The list A
contains several hundred thousand of such records; the list B
contains a couple of ten thousand.
To add more complications,
- To match, it is necessary that the number of vectors be the same, but not their order
- To match all values
id
and status
match px
, py
, pz
, , , .
, , , .
, , , , " " . : - , , , , , ? - , ?