Questions tagged [n-ary-tree]

38 questions
0
votes
0 answers

How to visualise java n-ary tree

I would like to know if there is a way to visualise non binary tree in this way : the root to be at the top, its children under and so on .. It is important the children to be connected (with lines may be) to their parents. The visualisation may be…
0
votes
1 answer

Gnome N-ary Trees usage in c++

I'm trying to implement an N-ary Tree in c++ using the glib, but as I'm not a c++ expert, I'm having some problems finding out how to use it right. Does anybody have a simple example written in C++ to help me understand how to use the basic…
0
votes
1 answer

How to reparent using tree.hh

Here I have a window with a list of groups of rows. In the image above, Path 2 to 6 are children of Group1. https://i.stack.imgur.com/zb4FB.png The container used for this tree is tree.hh. What function would I use to make Group1 (and its children)…
-1
votes
1 answer

How do I sum all the elements from the leaf to the root of each branch in a n-ary tree in OCaml?

I'm trying to make a function in OCaml where, given a n-tree, it returns a list of all the sums from leaf to root of all the branches. This is what i did: exception NotFound type 'a ntree = Tr of 'a * 'a ntree list let leaf x = Tr (x, []) let alb…
-1
votes
4 answers

Data structures get maximum value at each level of N-ary tree

Lets say I have a n-ary tree something like below I need to find maximum value at each level and return like : [8,7,32] . 8 4 3 7 1 4 3 3 5 6 7 12 32 3 1 My Node will look…
sidkool3k
  • 43
  • 10
-1
votes
1 answer

C - deleting n-ary tree nodes

I have implemented in C an m,n,k-game with AI. The game works fine but when I have to free the decision tree it always throws an "Access violation reading location" exception. This is the implementation of the decision tree structure: typedef…
-2
votes
1 answer

How do I check if there is a child at an n position in a n-ary tree in OCaml?

I'm trying to make a function that, given a tuple list (I don't know if tuple is the correct term, what i mean is a (x,y) list) and an n-ary tree, it returns the leaf that you get from checking if a key in the tuple is present in the tree, and…
-5
votes
1 answer

How to fix was not declared in this scope error

I write a code for printing and finding sum of the nodes in the n-ary tree but I get an error and I cannot fix it. #include #include using namespace std; class Node { public: Node(int input) { this->data = input; …
Alan turan
  • 1
  • 1
  • 1
1 2
3