write an algorithm to determine if two binary trees are identical when the ordering of the subtrees for node is ignored for exampleif tree has root node with value rleft child with value and right child with value bthis would be considered identical to another tree with root node value rleft child value band right child value make the algorithm as efficient as you can analyze your algorithm' running time how much harder would it be to make this algorithm work on general tree write postorder traversal function for general treessimilar to the preorder traversal function named print given in section write function that takes as input general tree and returns the number of nodes in that tree write your function to use the gentree and gtnode adts of figure describe how to implement the weighted union rule efficiently in particulardescribe what information must be stored with each node and how this information is updated when two trees are merged modify the implementation of figure to support the weighted union rule potential alternative to the weighted union rule for combining two trees is the height union rule the height union rule requires that the root of the tree with greater height become the root of the union explain why the height union rule can lead to worse average time behavior than the weighted union rule using the weighted union rule and path compressionshow the array for the parent pointer implementation that results from the following series of equivalences on set of objects indexed by the values through initiallyeach element in the set should be in separate equivalence class when two trees to be merged are the same sizemake the root with greater index value be the child of the root with lesser index value ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( using the weighted union rule and path compressionshow the array for the parent pointer implementation that results from the following series of equivalences on set of objects indexed by the values through initiallyeach element in the set should be in separate equivalence class when two trees to be merged are the same sizemake the root with greater index value be the child of the root with lesser index value ( ( ( ( ( ( ( ( ( ( ( ( ( (