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

186
Vistas
What is the time complexity of Map.prototype.keys()?

I am trying to calculate the time complexity of this particular line in one of my functions:

return [...cache.keys()].sort((a, b) => a - b);

This line is supposed to return a sorted Array of the Map's (cache) keys. I know that Array.prototype.sort() has O(n log n) time complexity. What is the time complexity of Map.prototype.keys()?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Creating the iterator is O(1), iterating all entries and creating an array from them is linear in the size of the collection - O(n).

Depending on the implementation, the number of recently deleted entries might have an impact, but it never should be large enough to change the time complexity to become non-linear.

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