Binary tree (pre order)

Why we’re first making a same function public and again making it private ?
Why aren’t we using same function for once??