if (!head->next) {
head->next = newNode; /* if only dummy node, add node to end of list */
} else {
/* iterates through linked list until a node is found that is greater than the new node */
while (head->next && strcmpa((head->next)->data, newNode->data) < 0)
head = head->next;
if (!head->next) {
head->next = newNode; /* adds new node to end list if no nodes are greater in value */
} else {
newNode->next = head->next; /* points new node to the next node */
head->next = newNode; /* points current node to new node */
}
}
if (!head->next) {
head->next = newNode;