struct val{
mutable int deg=0;
ll wgt=0;
bool operator<(const val& t) const{
if(this->deg != t.deg){
return (this->deg > t.deg);
}
return (this->wgt > t.wgt);
}
};
I wrote this code by refering to internet but I don’t know how to write such comparators, etc. for structs and custom sorting functions. So please tell some good resources which I can refer for this.