Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- struct Node
- {
- int x;
- Node *pLeft, *pRight;
- };
- typedef Node * Tree;
- void Count_la(Tree T, int &dem)
- {
- if (T != NULL)
- {
- if (T->pLeft == NULL && T->pRight == NULL) dem++;
- Count_la(T->pLeft, dem);
- Count_la(T->pRight, dem);
- }
- }
- Node * Search_node(Tree T, int key)
- {
- if (T != NULL)
- {
- if (T->x == key) return T;
- if (T->x > key) return Search_node(T->pLeft, key);
- else return Search_node(T->pRight, key);
- }
- return NULL;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement