function v = CS5350_tree_decide(nodes,x)
%

n = 1;
type = nodes(1).type;
while type>0
    att = nodes(n).value;
    x_ind = x(att) + 1;
    num_children = length(nodes(n).children);
    x_ind = min(num_children,max(1,x_ind));
    n = nodes(n).children(x_ind);
    type = nodes(n).type;
end
v = nodes(n).value;
