← Back to problems
UNSW COMP2521 · hard

24T2 Q12 — Min difference on a BST level

stdin: first line N L; second line N ints inserted (in order) into a BST (duplicates ignored). Root is level 0. Print the minimum absolute difference between any two values on level L; print 0 if that level has fewer than 2 values.


Single-file C (gcc -O0 -Wall). Self-contained reframing of the exam's ADT-completion question. From COMP2521 24T2 Sample.