A developer is processing a large log file and needs to store unique IP addresses to count the visitors. The order of the IP addresses is not important. Which data structure is the most memory-efficient and performant for this specific task?
-
A
A list, because it is simple to append to.
-
B
A dictionary, using IP addresses as keys.
-
C
A tuple, because it is immutable.
-
D
A set, because it only stores unique elements.