0

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.

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by deceptikon
0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.