Normally the insertion in a Binary Search Tree is done by recursion so these few lines of code show that how to achieve the same task by a loop instead of using a recursion. The code seems a bit complicated at first glance but there is just basic things like checks that are getting handeled in this code.
HarisAli-git/BST_IterativeInsert
This code is for the iterative insert in the Binary Search Tree
C++MIT