There is a way to use customized comparison function in C++ priority_queue. Instead of reloading the ‘less than’ operator, one can also write a compare class in which the ‘()’ operator is reloaded when defining. Here is an example:
1 |
|
There is a way to use customized comparison function in C++ priority_queue. Instead of reloading the ‘less than’ operator, one can also write a compare class in which the ‘()’ operator is reloaded when defining. Here is an example:
1 | #include<bits/stdc++.h> |