Function as parameter

Cant the compare function still be used within the bubble sort function if it wasn’t passed as a parameter?

yes you can do that here

but when you use any inbuilt function like sort() you have to pass your custom compare function
in video implementation of same done of to understand better how comparator works

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.