The fact that each of the tree's nodes contains zero or more child nodes makes it a general tree, and the number of children seen makes it a binary tree. On this tree, the preorder traversal is executed
The insertion pattern observed in relation to the provided values is shown below
1- Before successfully inserting the value, insertion did a single comparison with the root.
2- Starting at the root, insertion did two comparisons.
3- Starting at the root, insertion did three comparisons. Based on the recurrent pattern.
T(0) = C1
T(n) = T(n-1) + C2 for n > 0, n = height where C1 & C2 are constants
= T(n-2)+ 2C2
=n times
=T(0) + nC2
= C1 + nC2
=O(n)
The method, however, has a worst-case temporal complexity of O. (n)
Reference
Shaffer, C (2011). A Practical Introduction to Data Structures and Algorithm Analysis
retrieved from https://people.cs.vt.edu/shaffer/book/JAVA/3e20130328.pdf