Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int Baum_Find(Knote *Head, int Data) {
- Knote *a;
- a = Head;
- if (a->Right != NULL) {
- while (a->Data != Data) {
- if (a->Data == Data) {
- return a->Anzahl;
- }
- }
- if (a->Right != NULL) {
- Baum_Find(a->Right, Data);
- }
- }
- if(a->Left != NULL){
- while (a->Data != Data) {
- if (a->Data == Data) {
- return a->Anzahl;
- }
- else if (a->Left != NULL) {
- Baum_Find(a->Left, Data);
- }
- }
- }
- return -1;
- }
- double Baum_Avg(Knote *Head) {
- static double avg = 0.0;
- static int i = 0;
- if (Head->Left != NULL) { avg = Baum_Avg(Head->Left); }
- if (Head->Right != NULL) { avg = Baum_Avg(Head->Right); }
- return avg*(i - 1) / (++i);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement