sort 寫法
sort( level_order.begin(), level_order.end(), [&](const int a, const int b)
{
return IdToNode[a].level < IdToNode[b].level;
} );
level_order: vector to be sorted
level_order.begin() = a (an int)
level_order.end() = b
stable_sort( level_order.begin(), level_order.end(), [&](const int a, const int b)
{
return IdToNode[a].level < IdToNode[b].level;
} );
{
return IdToNode[a].level < IdToNode[b].level;
} );
level_order: vector to be sorted
level_order.begin() = a (an int)
level_order.end() = b
stable_sort( level_order.begin(), level_order.end(), [&](const int a, const int b)
{
return IdToNode[a].level < IdToNode[b].level;
} );
留言
張貼留言