3 ms·
Double linked list is just an example. There are other both more useful and harder to generalize structures like various kinds of trees for example. Anyway, if
by bluecalm 6y ago
Double linked list is just an example. There are other both more useful and harder to generalize structures like various kinds of trees for example.
Anyway, if your question is why implement your own data structures then it's very likely C/C++ isn't a proper tool for your job anyway.
- Silhouette 6y agoThere are other both more useful and harder to generalize structures like various kinds of trees for example. Trees are usually easy because each node has a single parent all the way up to the root and ownership can follow the same hierarchy. More general graphs are a little more tricky, but the same techniques that you can use to implement a specific case like a DLL generalise. For example, in Rust, you can combine Option and Rc to handle, respectively, the intermediate states while the structure is being manipulated and the shared ownership semantics.