Does anybody knows that how we can assign number to nodes for binomial tree . I mean how we can represent the number of nodes by array? please give me hint I am really confused .

  • $\begingroup$ I don’t understand your question at all. Perhaps you could give an example? $\endgroup$ – Yuval Filmus Oct 15 '19 at 17:26
  • $\begingroup$ What do you mean by binomial trees? $\endgroup$ – Marcelo Fornet Oct 15 '19 at 18:33
  • $\begingroup$ I want to create a binomial tree then number its node and then represent the tree by array that array index represent the number that we have specified to node . $\endgroup$ – graphicart86 Oct 15 '19 at 20:15
  • $\begingroup$ The problem here might be one of terminology: if you mean a tree for which every node has zero, one, or two children, many people refer to those as $binary$ trees. $\endgroup$ – Rick Decker Oct 15 '19 at 23:44
  • $\begingroup$ @RickDecker - maybe OP means this: en.wikipedia.org/wiki/Binomial_heap $\endgroup$ – HEKTO Oct 16 '19 at 14:30

In a binary tree, you can represent the tree from root to leaves as follows:

0 root 1 2 root's children 3 4 5 6 root's grandchildren etc.

To get the children of a node, you take its index x and compute 2x+1 and 2x+2.

This makes some certain assumptions: Each node has exactly two children, except the leaves, which are all on the same (or two neighboring) levels. If a level is not full, it is filled from left to right.

| cite | improve this answer | |
  • $\begingroup$ you mean representing of a binomial tree is by binary tree ? $\endgroup$ – graphicart86 Oct 16 '19 at 12:41
  • $\begingroup$ I thought you meant binary tree. I don't know what you mean by binomial tree, sorry. $\endgroup$ – Simon Weber Oct 17 '19 at 14:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.