I want to store a general tree in C using parent pointer approach (a node store pointer to开发者_JAVA技巧 its parent node only). Is there any standard library for this?
Thanks in advance
Google shows me to GNU C Library. Are you looking for something more?
How about Ben Pfaff's libavl?
Granted, you will need some time to read the excellent documentation, but if you seriously want to work with trees, then it's well worth each single hour.
There is a library called "libc": man tsearch
:)
I don't know what you mean by
parent pointer approach (a node store pointer to its parent node only)
but if you by chance mean that nodes should store pointers to their data, instead of the data incorporating node info, then my C language library of AVL trees could be what you are looking for.
I'm not quite sure, but when having trees of data it might be more handy to use C++ for that as it allows you to easily build hierarchies of objects which all have pointers to their parents and children.
Have you tried codesearch?
精彩评论