Posts in category 'data structures'

From O(n²) to O(n): Replace Nested Loops with a HashMap in Java

One endpoint in a B2B order system I worked on returned 1,000 orders, and it was slow. The database wasn’t the problem. Two innocent-looking nested loops were. Here’s how one...

Java Data Structures: Which One to Use and Why (with a Big-O Cheat Sheet)

Choosing the wrong data structure is one of the most common reasons code is slow, and one of the most common interview questions. A list where you needed a map...