Java Associate — Hard
Key points
- Hash collisions can cause worst-case time complexity in `HashMap`
- O(1) average time complexity is maintained for most lookups
- Java 8 introduced tree bins to improve worst-case to O(log n)
- Worst-case scenario involves linked list traversal in the same bucket
Ready to go further?
Related questions
