HOW to take level order input in left view or right view problem?

node* levelOrderInput(int* arr ,int i , int n){
if(arr[i] == -1 && i <= n)
return NULL;
if(i>n)
return NULL;
root = new node(arr[i]);
{root->left = levelOrderInput(arr ,root->left, 2i + 1 , n);}
root->right = levelOrderInput(arr ,root->right, 2
i + 2 , n);
return root;
}

int main(){
int arr[1000];
int tp = 1;
int i =1 ;
int j = 1;
cin>>arr[0];
while(tp != (2*i +1)){
cin>>arr[j];
if(arr[j] != -1){
j++;
tp++;
i++;
}
else{

              tp++;
              j++;
       }
   } 
  node* temp = levelOrderInput(arr , temp, 0 , tp-1 );
      preorder(temp); //if printing preorder , not printing all values.
   return 0;

}

I not able to understand what you are trying to ask, it would be great if you could post the link to question.