t = tree('root');
[ t node1 ] = t.addnode(1, 'Node 1'); %% attach to root
% node1 now contains the index of the first node.
[ t node2 ] = t.addnode(1, 'Node 2'); %% attach to root
[ t node11 ] = t.addnode(node1, 'Child of node 1'); %% attach to first node
disp(t.tostring)
t=t.removenode(node1);
disp(t.tostring);
t.get(1)
t.get(node2) // wrong result return!
I expected the result of get(node2) is 'Node 2', but get the 'Child of node 1'! why???
where is wrong?
t = tree('root');
[ t node1 ] = t.addnode(1, 'Node 1'); %% attach to root
% node1 now contains the index of the first node.
[ t node2 ] = t.addnode(1, 'Node 2'); %% attach to root
[ t node11 ] = t.addnode(node1, 'Child of node 1'); %% attach to first node
disp(t.tostring)
t=t.removenode(node1);
disp(t.tostring);
t.get(1)
t.get(node2) // wrong result return!
I expected the result of get(node2) is 'Node 2', but get the 'Child of node 1'! why???
where is wrong?