出处:https://blog.csdn.net/weixin_39460667/article/details/82695190
引入头文件
#include<algorithm>
结构体
bool compare(const node &x, const node &y) { return x.v > y.v; }
当用 大于号就是从大到小排序
用小于号就是从小到大排序
sort 函数
sort(branch+1,branch+m+1,compare);
出处:https://blog.csdn.net/weixin_39460667/article/details/82695190
引入头文件
#include<algorithm>
结构体
bool compare(const node &x, const node &y) { return x.v > y.v; }
当用 大于号就是从大到小排序
用小于号就是从小到大排序
sort 函数
sort(branch+1,branch+m+1,compare);
本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。