I have 2 files. One (let's say file F1) is a cvs file with around 200K rows and 3 columns. Each row represents an interval and rows are arranged in increasing order. For example:
1000,1340,yes
1400,1800,no
1810,2000,maybe
...
Another text file (F2) has around 10K rows and they are not ordered. I need to iterate through F2 and find row it belongs to, take the 3rd element from that row (yes, no or maybe) and append it to F2. For example, if F2=[1402,1100,1900], the updated F2 would be:
1402,no
1100,yes
1900,maybe
Is there any more elegant way of approaching this other than brute force approach? I was thinking to find the first element in F1 that is greater or equal than element in F2 we are using and then run a search (or binary search) of the remainder. Any hints would be appreciated.