Hi this is probably the last question ill ever have to ask. I was given some source for a mnerge sort for a singly linked list as followed.
struct node {
    struct node *next;
    char name[100];
} *list;

static void recurse_merge_sort(struct node **root, int(*cmp)(struct node *, struct node *))
    struct node *a, *b;
    for(a = b = *root; (b = b->next) && (b = b->next); a = a->next);
    b = a->next;
    a->next = 0;
    a = *root;
    if(a->next) recurse_merge_sort(&a, cmp);
    if(b->next) recurse_merge_sort(&b, cmp);
    while(a && b) {
        if(cmp(a, b) < 0) {
            *root = a; root = &a->next; a = a->next;
        } else {
            *root = b; root = &b->next; b = b->next;
    *root = a ? a : b;
void merge_sort(struct node **root, int(*cmp)(struct node *, struct node *))
    if(*root && (*root)->next) recurse_merge_sort(root, cmp);
int node_cmp(struct node *a, struct node *b) {
    return(strcmp(a->name, b->name));
Which I was wondering if I could edit this code to apply to my linked list structure below to sort by and one of the fields(doesnt matter to me). Im not very good with sort algoritms, if someone could help it would be greatly appreciated. Thank you.

class Part
		string Make;       
		string Model;      
		string PartType;
		int Year;
		string PartCode;
		float Cost;
		Part* next;

		Part(string, string, string, int, string, float, Part*);	

Part::Part (string tempMake, string tempModel, string tempPartType, int tempYear, 
		   string tempPartCode, float tempCost, Part* tempNext):Make(tempMake), 
		   Model(tempModel), PartType(tempPartType), Year(tempYear), 
		   PartCode(tempPartCode), Cost(tempCost), next(tempNext){}


typedef Part* PartPtr;
Thanks Again!