Advertisement
Guest User

Untitled

a guest
Dec 18th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1.  
  2. void recur(Node root, string prefix){
  3. if (!root){
  4. return;
  5. }
  6. if (root->value == '\0'){
  7. print(prefix);
  8. }
  9.  
  10. recur(root->firstChild, prefix + root->value​‌‌‌);
  11. recur(root->rightSibling, prefix);
  12. }
  13.  
  14. void display(Node root){
  15. if (!root){
  16. print("");
  17. }else{
  18. string prefix = "";
  19. recur(root, prefix);
  20. }
  21.  
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement