Well, a horribly inefficient, but likewise easy method would be to use a BubbleSort, referring back to original TreeNode.
bool done = false;
int length = trvw2.Nodes.Count;
while(!done)
{
done = true;
for(int i = 1; i<length;> {
if(trvw1.Nodes.IndexOf(trvw2.Nodes[i])<trvw1.Nodes.IndexOf(trvw2.Nodes[i-1]))
{
done = false;
//INSERT NODE SWAP CODE
}
}
}
I would include the "NODE SWAP CODE," but I'm not anywhere that I can check syntax, so yeah. Sorry if it doesn't work or if there are small errors - I'm working entirely off of memory. EDIT: Fixed typos.
There is no knowledge that is not power. - Mortal Kombat