|
-
April 9th, 2011, 06:43 PM
#1
How to do this sorting of a list of class type?
Hi all,
I have got a list of class type that I need to do list.sort() on.
the class type is
Code:
class node_info{
public:
node_number;
node_gain;
}
And I have a list to store all these class types: list<node_info> node_list;
for example, initially the list of 3 elements would be like {{0,3},{1,2},{2,1}}
After the sort, i would like it to be like{{2,1},{1,2},{0,3}}
Could anyone tell me how to do this kind of trick? Would the time complexity be nlogn for this kind of sorting?
Thanks a lot
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|