from DataStructures by Paul Richards
Set and map datastructures implemented in pure Matlab

TreeNode(value, isroot)
function node = TreeNode(value, isroot)
    % Internal class used by SortedSet.
    % Represents a single node within a binary tree.
    if nargin < 2
        isroot = false;
    end
    
    node.value = value;
    node.left = 0;
    node.right = 0;
    node.red = ~isroot;
    node = class(node, 'TreeNode');
end

Contact us at files@mathworks.com