Questions tagged [multiway-tree]

A multiway tree is a tree where each node can have a variable number of children.

A tree data structure is a structure consisting of nodes with some number of children. Many trees a binary trees (each node has 0, 1, or 2 children), though trees with multiple children exist as well. This tag is appropriate for questions specifically about multiway trees.

52 questions
4
votes
2 answers

Practical use of m-way tree

I have started studying data structures again . I found very few practical uses of this. One of those were about file system on disk . Can someone give me more example of practical uses of m-way tree .
rtcoms
  • 783
  • 1
  • 8
  • 19
4
votes
1 answer

Decode JSON Multiway Tree into an F# Multiway Tree Discriminated Union

I have the following JSON data in a documentdb and I would like to parse this into an F# multiway tree discriminated union "commentTree": { "commentModel": { "commentId": "", "userId": "", "message": "" }, …
3
votes
2 answers

How to memoize the repeated subtrees of a game tree (a potentially infinite rose tree)?

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)). However, often there are positions that can be reached…
Qqwy
  • 5,214
  • 5
  • 42
  • 83
3
votes
4 answers

Does anyone know where I might find a file based multi-way B-Tree Class for c#?

I need to implement a file based multi-way B-Tree Class for c#. There is similar functionality available for C++ and C but I want to use it in C#. It also need to be available as source code as I wish to use with some alternative .NET…
AnthonyLambert
  • 8,768
  • 4
  • 37
  • 72
3
votes
1 answer

Making a multiway tree a heap after a node's key has changed?

The tree has invariance that the parent node must always be smaller than its child, like the image shown above. Now suppose some of the node's key has changed and breaks the invariance and I want to maintain the invariance. I think it's basically…
Arch1tect
  • 4,128
  • 10
  • 48
  • 69
2
votes
2 answers

How to represent data to be used for DFS/BFS

I was assigned a problem to solve using various search techniques. The problem is very similar to the Escape From Zurg problem or the Bridge and Torch problem. My issue is that I am lost as to how to represent the data as a tree. This is my guess as…
MikeKusold
  • 1,632
  • 15
  • 25
2
votes
2 answers

M way Search Tree

I would like to implement a m-way search tree and i need the basics of implementation of m-way search tree. Can anyone provide me good resources that would help me in implementing the same??
nikhil
  • 9,023
  • 22
  • 55
  • 81
2
votes
2 answers

Elm - decoding a recursive multiway tree

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 json of this kind into it { "id": "root", …
Dylanbob211
  • 1,064
  • 1
  • 10
  • 15
2
votes
0 answers

How to build a multiway tree from lists

I have to build a multiway tree by merging multiple lists together. I am trying to find an efficient algorithm to do that. There can be identical lists List elements are not unique. The paths to these elements are The tree starts with a null root…
nadeaud
  • 61
  • 5
2
votes
1 answer

What would you build using a multiway search tree.

I am currently teaching myself about various data strutures and am a little frustrated with the various types of trees. I can understand the purpose of organizing something into binary search trees but don't see any practical application of multiway…
confused
2
votes
1 answer

Trim a Multiway Tree - what is a better solution?

I was wondering whether anyone could offer a more simplified solution or improvements to my code for the following problem. Say we have a tree with branches going to some depth "d" And we would like to trim this tree, such that we preserve "n"…
dusio
  • 480
  • 5
  • 18
2
votes
2 answers

Multiway Tree search algorithm in C implementation

typedef struct dt { .....; } Data; typedef struct nd { int id; Data *data; struct tm *_parent; struct tm *_child[7]; } Node; Node* findNode(int id, Node *tree) { Node *p = tree; if (id == p->_id) return p; …
ChrisGeo
  • 3,807
  • 13
  • 54
  • 92
2
votes
5 answers

Finding the height of a multiway tree

How do you find the height of a multi-way tree? If I wanted to find the height of a binary tree, I could do something like this: int height(node *root) { if (root == NULL) return 0; else return max(height(root->left),…
Bramble
  • 1,395
  • 13
  • 39
  • 55
1
vote
1 answer

Elm - fold on recursive type with list does not compile

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 anyType)) What i wrote is this: foldTree fLeaf fTree…
Dylanbob211
  • 1,064
  • 1
  • 10
  • 15
1
vote
2 answers

Print tree node and all of it's childs efficiently

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 #include #include #define SIZE …
J. Homer
  • 147
  • 1
  • 11