Create a program to construct a binary search tree consisting of nodes that each stores an integer in Java.Avoid duplication of values when inserting nodes in the tree. When a new leaf node is created list all the nodes in the path from the newly added leaf node to the root of the tree. It is sufficient to list only the value the node holds since duplication is not permitted. When listing each node also print the next two children in the path from the root to the newly added leaf node.
For example. Assume a binary search tree is constructed from the values 14, 35, 2, 3, 39, and 27. Now suppose the value 37 is added to the tree. When inserting 37 your program should print out something similar to the following:
37 -> null -> null
39 -> 37 -> null
35 -> 39 -> 37
14 -> 35 -> 39
Generate random values between zero and twice the number of values to add to the tree. For example, if you are inserting ten values (not necessarily unique) then the random values would fall between 0 and 20. Generate random integers to create a tree containing up to the number of nodes indicated by a command line argument (perhaps less if duplication occurs).