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

189
Views
How does javascript Set can keep the order of insertion and still have 0(1) lookup "Set.has()"?

I have been studying data structures and I do get that Set use implementation similar to hash tables, so the input value + the hash algorithm will create a index where the value is stored...

This will yield the ability to search for such value later in constant time o(1) (disregarding collisions) however this comes at expense of not having an ordered collection since the positions in the collection are computed during insertion instead of order insertion,

So the question is how Set can keep the order and still have constant time on the lookup method Set.has()?

Thank you in advance!

about 4 years ago · Juan Pablo Isaza
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!