java
Q1. BST:
1. Write a method that takes an array A, as parameter (A containsthe elements of a BST traversed in preorder) and returns thecorresponding BST.
2. Write a method to list the nodes on the path from the root to agiven node in the BST.
3. Write a recursive method to check if two BSTs are same.
4. Write a non-recursive method to check if two BSTs aresame.
5. Write a method to count the number of nodes in BST with a singlechild.
6. Write the main program to test your methods.
Q2. Design and implement a program to read information about roadsconnecting a
OR
OR