Comparators- Understanding the working

i don’t understand passing of function into another function.

use of passsing comparator is so that the comparisons are done according to compare function made by user

exactly which thing you expect to be explained more?