Advertisement
Guest User

Untitled

a guest
Dec 15th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. void suchbaum::knoten_ausgeben(BaumKnoten* knoten, int tiefe) {
  2.  
  3. if (knoten==nullptr)
  4. {
  5. return;
  6. }
  7. int depth = tiefe;
  8. knoten_ausgeben(knoten->right_child,depth+1);
  9. if (depth!=0)
  10. {
  11. for (int i = 1; i <= depth * 2; i++)
  12. cout << "+";
  13.  
  14. }
  15. cout << knoten->data << "\n";
  16.  
  17. knoten_ausgeben(knoten->left_child, depth+1);
  18. }
  19. void suchbaum::ausgeben(BaumKnoten* wurzel) {
  20.  
  21. if (wurzel == nullptr)
  22. {
  23. cout << "Leerer Baum."<<endl;
  24. }
  25. else
  26. {
  27. suchbaum::knoten_ausgeben(wurzel, 0);
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement