From 23de3d36aa5f9a0a8d1ee5c26a12cae97d40a983 Mon Sep 17 00:00:00 2001 From: tarunpratap9754 Date: Tue, 19 Jun 2018 14:09:39 +0530 Subject: [PATCH] Update ConstructBinaryTreeFromInorderAndPreorder.cpp Passing the inorder array by reference to cut down the TLE problem ! --- Trees/ConstructBinaryTreeFromInorderAndPreorder.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Trees/ConstructBinaryTreeFromInorderAndPreorder.cpp b/Trees/ConstructBinaryTreeFromInorderAndPreorder.cpp index 1076071..007d778 100644 --- a/Trees/ConstructBinaryTreeFromInorderAndPreorder.cpp +++ b/Trees/ConstructBinaryTreeFromInorderAndPreorder.cpp @@ -7,10 +7,10 @@ * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */ -int index(vector v, int val, int start, int end){ +int index(vector &inorder, int val, int start, int end){ int i; for(i = start; i <= end; i++){ - if(v[i] == val){ + if(inorder[i] == val){ return i; } }