You are implementing **Kruskal’s Algorithm** to find a Minimum Spanning Tree. Which data structure is essential to efficiently detect if adding an edge will form a cycle?
You need to keep track of whether 1,000 specific IDs have been "visited." Instead of an Array of Booleans, you use a Bitset (where 1 bit = 1 ID). This is an optimization of: