Graphs & Connectivity Hard
Contact Bubble Reduction (Greedy)
The exercise greedily removes contacts that keep too-large neighbor sets connected; repeated contacts do not create repeated relationships.
Trace input
Bounded JSONEdit the lesson input, then build a deterministic source-linked trace.
Source scenarios
Complexity
BestO(C + P)
AverageO(C + P)
WorstO(C·P)
SpaceO(P + C)
Array state
Follow the active comparisons and writes.
Current operation
Trace stateReady to explore
Source behavior & common mistakes
Follow the source’s two passes and return each forbidden pair in the order it is removed.
- Counting duplicate contacts as separate people.
- Replacing the source’s greedy two-pass behavior with a different optimization algorithm.
Algorithm code
JavaBubbles.javaStep linked
The highlighted line follows the current step.
Ready to begin
Press Play to see what happens.
Detailed execution
Snapshot 1 / 1