Please i'm having problems sorting nodes in a linked list but i can sort the data members and i want to know if sorting the nodes themselves in
the list is necessary at all. In other words are there instances where nodes are specifically needed to be sorted.
Also, why is the string data member of a node in a linked list not destroyed when the node itself is destroyed.
please i need help.

In other words are there instances where nodes are specifically needed to be sorted.

Yes. Ordering of data is one of the most fundamental tasks. Whether you're using a linked list, an array, or a tree structure, some kind of ordering will be needed in the majority of cases.

Also, why is the string data member of a node in a linked list not destroyed when the node itself is destroyed.

We can't read your code unless you post it, so I'll assume that your list doesn't use RAII-friendly objects like std::string for this "string data member". In such a case, the string memory isn't destroyed because you don't destroy it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.