We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
There is no data (well, you could say node's own index is its payload). It's just a bunch of indexes. So the root has node number 2 as a left child and also a right child. And node number three has itself as a right child.
Not a tree. Somebody just doesn't understand the format. Which really isn't surprising given the poor description.
But if anyone wants it blow by blow:
5 // there are five nodes
2 2 // root (node 1) has node 2 as left child and node 2 as right child
Swap Nodes [Algo]
You are viewing a single comment's thread. Return to all comments →
There is no data (well, you could say node's own index is its payload). It's just a bunch of indexes. So the root has node number 2 as a left child and also a right child. And node number three has itself as a right child.
Not a tree. Somebody just doesn't understand the format. Which really isn't surprising given the poor description.
But if anyone wants it blow by blow: