Sorting a linked list which is in a class c++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Sorting a linked list which is in a class c++

I want to sort a single linked list which is already there in a class using c++ https://code.sololearn.com/cZCsi2DPMCpy/?ref=app

17th Oct 2017, 6:33 PM
Naveen Gowda
Naveen Gowda - avatar
2 Answers
0
I want to do an insertion sorting for a linked list
17th Oct 2017, 7:03 PM
Naveen Gowda
Naveen Gowda - avatar
- 1
void BookList::insert(BookNode *node) { BookNode* tmp; tmp= new BookNode; tmp->bk = node->bk; tmp-> next = head; head = tmp; } I'm just adding new nodes to the list I want to sort them according to their number which is there in object bk
17th Oct 2017, 7:25 PM
Naveen Gowda
Naveen Gowda - avatar