Ready to begin
No records have been processed. Start with Next step.

Follow one occurrence at a time. Choose another input to test empty lists, repeated IDs and different parameters.
Ready
No records have been processed. Start with Next step.
Predict the next change, then step through the list. The original course records remain unchanged.
SimilarPairs = []
foreach X in ScoreRecords:
foreach Y in ScoreRecords:
if X.CardNo < Y.CardNo AND abs(X.Physics-Y.Physics) <= 10:
SimilarPairs = SimilarPairs ++ [[X.CardNo,Y.CardNo]]The lecture first discusses similar performance in two subjects, then demonstrates the pair method for Physics alone. The explorer lets you choose either rule. Physics difference ≤ 10 gives 181 distinct unordered matching pairs. Requiring BOTH Maths and Physics differences ≤ 10 gives 67. Equality at ten is included here.
ID1 < ID2 excludes self-pairs and reversed duplicates. The displayed pseudocode visits all ordered combinations but filters its output. The explorer generates only i<j candidate pairs, so it performs 435 pair checks. Do not confuse unique stored pairs with the number of comparisons made by a less selective loop structure.
Marks 74 and 81 differ by 7; 81 and 85 differ by 4. Yet 74 and 85 differ by 11. So “within ten” does not guarantee transitivity. This numerical counterexample illustrates the rule and is not a claim that these three marks identify particular Physics cards in our dataset.
Stored pairs let us later count each student’s connections or search for triples whose three pairwise connections all exist. When pairs are stored in canonical smaller-ID-first order, lookups must respect that convention. A triangle of pairwise connections is stronger than merely finding a chain A–B–C. Finding a largest fully connected group is a further, harder problem.
Why is checking ID1 != ID2 insufficient to remove reversed duplicates?
It removes self-pairs but allows both [5,12] and [12,5]. A strict ordering such as ID1 < ID2 retains one orientation.
Does A close to B and B close to C prove A close to C?
No. The 74,81,85 example breaks that inference for an inclusive ten-mark threshold.
Does length(SimilarPairs) count students?
No. It counts stored relationships. One student can participate in many pairs.