重载运算符作用求教
  • 板块灌水区
  • 楼主Liu_Su_
  • 当前回复2
  • 已保存回复2
  • 发布时间2024/11/13 19:26
  • 上次更新2024/11/13 20:03:59
查看原帖
重载运算符作用求教
708057
Liu_Su_楼主2024/11/13 19:26

以下两段代码实现操作和时空复杂度上有什么区别吗?


struct node{
    int x,y,val;
};
struct cmp{
    bool operator()(const node &a,const node &b){
        return a.val<b.val;
    }
};
priority_queue<node,vector<node>,cmp>Que;

struct node{
	int x,y,val;
}edge[1005];
bool cmp(node a,node b){
	return a.val<b.val;
}
int main(){
	sort(edge+1,egde+m+1,cmp);
}

求教,感谢!

2024/11/13 19:26
加载中...