Comparing two binary tree means comparing to root, left & right nodes. If you know tree traversal, then this will be easy for you. If not, i will reommend to please read this article - Binary tree & traversal. Ok , so let’s create a compare function which will take…