List List::list_sort(char choice) { List L1; if (choice=='m') { if(head==NULL) L1.head=NULL; else { //copy first node in the new list L1.head_insert(head->data); Inventory_node* orig_ptr=head->next; //insert the rest in alphabetical order while(orig_ptr!=NULL) { L1.insert_order(orig_ptr->data); orig_ptr=orig_ptr->next; } } } else { if (head==NULL) L1.head=NULL; else { //copy first node in the original list L1.head_insert(head->data); Inventory_node* orig_ptr=head->next; //insert the rest in increasing order while(orig_ptr!=NULL) { L1.insert_order_price(orig_ptr->data); orig_ptr=orig_ptr->next; } } } return L1; }