Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

137
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda