Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- // Definition for binary tree
- struct TreeNode {
- int val;
- TreeNode *left;
- TreeNode *right;
- TreeNode(int x) : val(x), left(NULL), right(NULL) {}
- };
- void changeData(TreeNode* root){
- root -> val = 20;
- }
- int lca(TreeNode* A) {
- A -> val = 10;
- cout<<A->val<<endl;
- changeData(A);
- cout<<A->val<<endl;
- }
- int main() {
- // your code goes here
- lca(new TreeNode(5));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment