% Validate a node (determine if its "leaves" have been resolved)
% 10may11
% B
%% Previous: orderloop

function [validation,k]=validate(tovalidate,leavesorder,nodesorder,matrix,n)
[found1,found2,k]=findpointer(tovalidate,matrix);
if found1<=n
    list=leavesorder;
else
    list=nodesorder;
end
found1validation=findorder(found1,list);
if found2<=n
    list=leavesorder;
else
    list=nodesorder;
end
found2validation=findorder(found2,list);
if found1validation==1 && found2validation==1
    validation=1;
else
    validation=0;
end

    
end