I have the following header class: and following implementation I have some struggles with my destructor, copy constructor and consequently, ope ...
I have the following header class: and following implementation I have some struggles with my destructor, copy constructor and consequently, ope ...
I need to find a solution for this problem: I have a n-ary tree structured in this way: I can't use another implementation of n-ary tree. My goal i ...
If you want to create a deep copy of a tree (so that each node in the tree is deep-copied), you have to use a recursive algorithm provided in the answ ...
I am stuck with a leetcode problem on N-ary tree since last few hours. Could anyone please help me? I am expecting: 1, 3, 2, 4, 5, 6 The output ...
Let us consider the following code. I am trying to create a resultant vector containing each level of an n-ary tree in a separate inner vector. What c ...
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 ...
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 ...
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] . My Node will look somethi ...
I have a university project where I need to implement an N-ary tree in dart. This is my node so far I am stuck on how I should implement the foll ...
I'm doing a homework for university. Is the first time I use tree as a data structure and I don't understand how to implement it in Java. I have to re ...
There will be q queries to the problem. In each query, you will be given a random node in the whole tree. Each node of the tree stores some integer va ...
Problem Statement: You are given an integer N denoting number of nodes in that tree. Now, you need to count, how many distinct paths are there in the ...
I have a list of Nodes/Vertices, and a list of lines/edges connecting these nodes.The lists are not sorted or ordered in any way, but contain all the ...
I would like to returns the level of a given node. I've been able to do this for binary trees but for n-ary trees there is no way to run it. Any ideas ...
I have to write a function to find the number of nodes in a level of a first child - next sibling N-ary tree. My function is: but it does not work. ...
Let the structure given by: The code below should give the Traverse in Level Given the tree: It returns But the expected is 1 2 3 4 5 6 7 ...
Given the following structure Where the children points to first child and to traverse to the other childs we need to follow node->children-> ...
I have a list of children and a list of parents. I also have a map of childeId-parentId. Parents can have n number of children but children have one i ...
I'm having some problems with a couple algorithms that should return the maximum degree (the max number of children of a node) and depth (dimension of ...
I'm creating a python class for a tree in which each node has a number of children given by "order" (but each child only has one node). I have a metho ...