Searching

5

1 votes
Easy
Problem

Given an integer x as input find whether a node with value x exists in the tree or not. (Use the previous code to construct the tree). All the contraints are same as previous question.

Input Format:

First line of input contains an integre n denoting number of nodes in the tree. Second line contains n space separated integers. Third line contains an integer q i.e. total number of queries, followed by q integers separated by newline character.

Output Format:

For each query, if node is presnet print "Yes" else print "No".

Sample Input
5
1 4 4 5 6
7
1
4
5
6
63
44
5
Sample Output
Yes
Yes
Yes
Yes
No
No
Yes
Time Limit: 5
Memory Limit: 256
Source Limit:
Editor Image

?