123456789101112131415
void linked_list::SortList(){ if(is_empty()) { return; } for(node_t *it =head; it!=tail; it = it->next){ int valToIns = it->value; node_t *holePos = it; while(holePos->prev && valToIns < it->prev->value){ holePos->value = holePos->prev->value; holePos = holePos->prev; } holePos->value = valToIns; } }