Merge k sorted array

in this why aren’t we making our own comparator class for our own user defined datatype … how does inbuilt greater<> class know that it has to compare the values of the nodes …

hello @gulatigarvita08 in which line you are talking about in your code ?

8 line …

hey @gulatigarvita08 it is just the syntax of the priority queue .
and in priority queue only using comparator class would not solve things because you just not have to sort but in that heap the tree is prepared from the array of your input.
so for min there is separate syntax and for max there is separate syntax .
in comparator class you have to write your own full code forit and inorderto save your time there we have this STL in which we can use priority queue like this .
i hope you have understood .

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.