sec the parent pointer implementation /*general tree class implementation for union/find *class parptrtree private integer [array/node array public parptrtree(int sizearray new integer[size]for (int = <sizei++array[inull/create node array /*determine if nodes are in different trees *public boolean differ(int aint binteger root find( )/find root of node integer root find( )/find root of node return root !root /compare roots /*merge two subtrees *public void union(int aint binteger root find( )/find root of node integer root find( )/find root of node if (root !root array[root root /merge string print(stringbuffer out new stringbuffer( )for (int = <array lengthi++if (array[ =nullout append("- ")else integer temp array[ ]for (int = <array lengthj++if (temp =array[ ]out append( ")breakreturn out tostring()public integer find(integer currif (array[curr=nullreturn curr/at root while (array[curr!nullcurr array[curr]return currfigure general tree implementation using parent pointers for the union/find algorithm