Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

136
Views
Finding similar values in multiple arrays of objects

Data:

array1 = [{"location": "The Green Lion", "postcode": "E1 6QE"}, {"location": "Diners Inn", "postcode": "E6 5FD"}]
array2 = [{"location": "Green Lion", "postcode": "E1 6QE"}, {"location": "Diner's Inn", "postcode": "E6 5FD"}]
array3 = [{"location": "The Green Lion", "postcode": "E1 6QE"}, {"location": "Diner Inn", "postcode": "E6 5FD"}]
//array1 size - 350 | array2 size - 544 | array3 size - 88

I'm using a fuzzy comparison function to find similar elements in an array. The issue I'm facing is that my current way of achieving this involves combining the 3 arrays into 1 and for looping it twice and then fuzzy comparing location.

combined.forEach(function (x) {
        combined.forEach(function (y) {
            if (fuzz.token_sort_ratio(x.location, y.location) > 80) {
                //Logic 
            }
        });
    });

Is there a more efficient way of achieving this instead of a nested for loop? The combined array size is 958 which means there are 917,764 iterations being ran, this doesn't seem like an efficient way of achieving this but because the value of location isn't always guaranteed to be the same, I can't use the .find() function (or can I?).

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I'd recommend to create map of the locations and store results in the quadtree. Quadtree is supported by JavaScript - see

https://github.com/timohausmann/quadtree-js

I've used successfully quadtree in my practice (implemented in C++). For large datasets it appeared to be at least 10X faster than quadratic algorithm.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!