CompleteKaryTree
CompleteKaryTree[n] gives the complete binary tree with n levels.
CompleteKaryTree[n, k] gives the complete k-ary tree with n levels.
Examples
Create a binary tree with 4 levels:
CompleteKaryTree[4]
(* Graph[...] *)Create a ternary tree with 3 levels:
CompleteKaryTree[3, 3]
(* Graph[...] *)Please visit the official Wolfram Language Reference for more details.