please explain doubly linked list method in words
Anonymous - Apr 6, 2014
please explain doubly linked list method in words
Added the basic algo for that:
1. Start with the root node and empty double list listNode
2. Add the value of the rootNode to the current listNode
3. Now whenever you go left, pass listNode.left and root.left and call step1 and 2 recursively.
4. Similarly for right node
Please let me know if I have not explained it properly.
There is a typo in this algo the code should be
t->next=listnode; @ line number 20 in pseudocode
Thank you for helping me fix it. I have updated the code.
See also
- Given a BST with 2 nodes swapped, fix it
- Given a binary search tree with 2 nodes swapped find number of pairs not following BST properties
- For a Given node of a binary tree, print the K distance nodes.
- Print all nodes that are at distance k from a leaf node
- Find the distance between 2 nodes in Binary Tree