Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int curIdx = 0;
- private Node Tree31(int curDeep, int n, int l, int[] arr)
- {
- if (curDeep >= l || curIdx>=n) return null;
- Node thisNode = new Node();
- thisNode.Value = arr[curIdx++];
- if (curDeep >= l || curIdx>=n) return thisNode;
- Node leftNode = Tree31(curDeep+1, n, l, arr);
- thisNode.Left = leftNode;
- if (curDeep >= l || curIdx>=n) return thisNode;
- Node rightNode = Tree31(curDeep+1, n, l, arr);
- thisNode.Right = rightNode;
- return thisNode;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement