Am I answering the question correctly?
Question:

A ternary tree is a tree in which every node can have at most 3children. So, for each node, we have 3 references: left child,right child and the middle child. An example ternary tree isdepicted above. There are four methods to be implemented, describedin the following.
●public int size()
returns the size (number of nodes) ofthe tree. In the depicted example tree, size() returns 10.
●public boolean contains(inttargetKey)
returns true if a target key exists inthe tree, otherwise returns false. In the above example
PayPal Gateway not configured
PayPal Gateway not configured