A developer needs to find if any duplicate patient IDs exist in a very large list containing millions of encounter records.
They are considering two approaches:
Approach A: Use a nested loop.
For each ID in the list, iterate through the rest of the list to check for a match.
Approach B: Iterate through the list once, adding each ID to a Hash Set.
If an ID is already in the set when attempting to add it, a duplicate has been found.
Which statement best describes the performance of these two approaches as the list size grows?