Advertisement
Guest User

Untitled

a guest
Feb 19th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. int Baum_Find(Knote *Head, int Data) {
  2. Knote *a;
  3. a = Head;
  4. if (a->Right != NULL) {
  5. while (a->Data != Data) {
  6. if (a->Data == Data) {
  7. return a->Anzahl;
  8. }
  9. }
  10. if (a->Right != NULL) {
  11. Baum_Find(a->Right, Data);
  12. }
  13. }
  14. if(a->Left != NULL){
  15. while (a->Data != Data) {
  16. if (a->Data == Data) {
  17. return a->Anzahl;
  18. }
  19. else if (a->Left != NULL) {
  20. Baum_Find(a->Left, Data);
  21. }
  22. }
  23. }
  24. return -1;
  25. }
  26.  
  27.  
  28.  
  29.  
  30.  
  31. double Baum_Avg(Knote *Head) {
  32. static double avg = 0.0;
  33. static int i = 0;
  34.  
  35. if (Head->Left != NULL) { avg = Baum_Avg(Head->Left); }
  36. if (Head->Right != NULL) { avg = Baum_Avg(Head->Right); }
  37.  
  38. return avg*(i - 1) / (++i);
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement