Implementation and traversals of Binary search trees and n-ary Trees