n-ary-tree

N-ary trees in C

Which would be a neat implemenation of a N-ary tree in C language? Particulary, I want to implement an n-ary tree, not self-ballancing, with an unbound number of children in each node, in which each node holds an already defined struct, like this for example: struct task { char command[MAX_LENGTH]; int required_time; }; ...

Extracting Leaf paths from n-ary tree in F#

Inspired by this question, I wanted to try my hand at the latest ponder this challenge, using F# My approach is probably completely off course, but in the course of solving this problem, I'm trying to get a list of all the permutations of the digits 0-9. I'm looking at solving it using a n-ary tree like so: type Node = | Branch o...

The "Ruby" way of doing an n-ary tree

I'm writing a Ruby script and would like to use a n-ary tree data structure. Is there a good implementation that is available as source code? Thanks. ...

N-ary search tree in java with Comparable userObject?

So let's say I'm building a Tree using javax.swing.tree.DefaultMutableTreeNode and I add N children to a particular node. I want the children to be in a particular order (based on Comparable/a custom Comparator) like a search tree, even if I insert them out of order, like this: node.insert(child2); node.insert(child3); node.insert(child...

F#: Recursive collect and filter over N-ary Tree

This is hurting my brain! I want to recurse over a tree structure and collect all instances that match some filter into one list. Here's a sample tree structure type Tree = | Node of int * Tree list Here's a test sample tree: let test = Node((1, [Node(2, [Node(3,[]); Node(3,...