Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int compare(Node *a, Node *b){
- int retVal = abs(b->f1_count - b->f2_count) - abs(a->f2_count - a->f1_count); //sort by how much they occur
- if(!retVal){ //if they occur the same (retVal would be 0) sort by name
- retVal = strlen(b->name) - strlen(a->name);
- if(!retVal) //if they are the same len (retVal would be 0) sort alphabetically
- retVal = strcmp(a->name, b->name);
- }
- return retVal;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement