Skip to main content
Stack Overflow
  1. About
  2. For Teams
Filter by
Sorted by
Tagged with
0 votes
1 answer
93 views

I need to compute the diameter of an N-ary tree represented as a Binary Tree (left-child, right-sibling representation). Can someone give me an idea or a pseudocode? My best attempt was to add a +1 to ...
0 votes
1 answer
16 views

Given a big multiway tree A and a small multiway tree B, how can we know if B is a sub-structue of A?
irasin's user avatar
  • 175
0 votes
0 answers
45 views

I'm trying to create a multiway binary tree from a parent array. The structure for my multiway binary tree nodes is the following: typedef struct x{ int id; struct x* son[MAX]; int index; }...
0 votes
1 answer
737 views

suppose we have a set of keys K = {1, 2, 3, 4, 5, 6,..., 15} and we need to build a two four tree out of this such that: CASE1 : the tree has the minimum number of nodes. CASE2 : the tree has the ...
2 votes
2 answers
151 views

I'm working on a recursive tree of this type type Node anyType = Leaf Id (Maybe anyType) Name | Tree Id (List (Node anyType)) Name where type Id = Id Int | Root and I'm trying to decode a ...
1 vote
1 answer
172 views

I'm following this article on catamorphism and I'm trying to define a fold function for a recursive data type like this type Node anyType = Leaf Id (Maybe anyType) | Tree Id (List (Node ...
0 votes
1 answer
813 views

As a newbie in functional programming (OCaml), I stuck with that problem. I came up with a code shown below: let rec height tr = match tr with | Node(d,[]) -> 1 | Node(d,[t1]) -> 1 + height ...
-2 votes
1 answer
350 views

Consider the following definition of a Rose Tree: The tree can contains unique nodes. data NTree a = Nil | Node { root :: a, subtree :: [NTree a]} deriving Show -- or just data NTree a = Nil | Node a [...
6 votes
3 answers
853 views

I would like to ask if someone knows a performant way to store the path from the root node to a new node of a multiway tree during the insertion of the new node. E.g., if I have the following tree: ...
3 votes
2 answers
482 views

I am attempting to implement the Negamax algorithm in Haskell. For this, I am representing the future possibilities a game might take in a rose tree (Data.Tree.Forest (depth, move, position)). ...
1 vote
2 answers
462 views

I am trying to make a function that would print a node and all of its children but I am trying to make it efficient and also recursive. But it doesn't really work. #include <stdio.h> #include &...
1 vote
1 answer
784 views

I have tried to traverse a multiway tree, but I'm trying to do in an efficient way but that doesn't really help me and more importantly I want to do it recursively. My idea was like this: I have a ...
0 votes
1 answer
492 views

I'm working with a version of a Tree of the type: Tree = Empty | Leaf Event | Split String [(String, Tree)] My aim is to get a function that returns a list of pairs [(Event,[Int])] with [Int] being ...
1 vote
1 answer
661 views

I would like to flatten a tree which looks like this: > data Tree a = Leaf a > | Fork a [Tree a] > | Root [Tree a] possible example: Root [Fork 'a' [Fork 'b' [...
1 vote
1 answer
390 views

15 30 50 per page
1
2 3 4

AltStyle によって変換されたページ (->オリジナル) /