出處: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刪除。