how to allocate a new node in binary tree using POBJ_NEW or PBJ_ALLOC

10 views
Skip to first unread message

Supriya Mishra SVNIT

unread,
Jan 12, 2023, 1:43:27 AM1/12/23
to pmem
Hi everyone,

I am trying to write a recursive algorithm to insert a new node to a PM based binary tree data structure. After traversing we get the right location to insert new node. but how to allocate memory for new node using libpmemobj library.


Can anybody help?


Best regards,
Supriya

Igor

unread,
Jan 12, 2023, 11:37:30 AM1/12/23
to Supriya Mishra SVNIT, pmem
Hello,

There are a few examples in libpmemobj and libpmemobj-cpp library that shows how to implement a persistent data structure:
https://github.com/pmem/pmdk/tree/master/src/examples/libpmemobj
https://github.com/pmem/libpmemobj-cpp/tree/master/examples

Specifically, I would recommend taking a look at the following, rather simple one:
https://github.com/pmem/libpmemobj-cpp/blob/master/examples/queue/queue.cpp

Best regards,
Igor

--
You received this message because you are subscribed to the Google Groups "pmem" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pmem+uns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pmem/16766852-cfbf-4a75-a5ce-128025a50680n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages