c - what is the time complexity of inserting set of elements into a binary search tree in the same order assumption 1 n is the no of nodes in that tree assumption 2 set of elements which are to be inserted are already in sorted order - skillgun

if we have set of elements which are already sorted, and try to insert them into the binary search tree in the same order, complexity is O(n)

if we have set of elements which are already sorted, and try to insert them into the binary search tree in the same order, complexity is O(log n)

if we have set of elements which are already sorted, and try to insert them into the binary search tree in the same order, complexity is O(n log n)

if we have set of elements which are already sorted, and try to insert them into the binary search tree in the same order, complexity is O(n^2)

Answer :

if we have set of elements which are already sorted, and try to insert them into the binary search tree in the same order, complexity is O(n)

Description :

if we have set of elements which are already sorted, and try to insert them into the binary search tree in the same order, then find function will take O(n). This is because since already elements are in sorted order, our tree will grow only on one side that is right side sub tree. so it is more of like a linked list. searching for an item on linked list is O(n) where n is no of nodes.