Quantcast
Channel: Go4Expert
Viewing all articles
Browse latest Browse all 1987

Sort Linked List then print

$
0
0
I have a linked list with string and int content.i can do operations on it like deleting,adding updating or printing etc.. the problem is i need to print them with respect to their numbers in descending order. Right now im adding new nodes to end of list so it prints old to new.

Should i sort them while adding or printing ? i guess i should sort them in adding function.i added comments possible place to do sorting.code is below
Code:
//list.h content
struct node{

       std::string...
Sort Linked List then print

Viewing all articles
Browse latest Browse all 1987

Trending Articles