00:01
Hello students, so firstly constructing the binary tree and post order transversal.
00:23
The given in order transversal is uinversid.
00:35
The given preorder transversal is uiimsrvey.
00:45
So to construct the tree we can use the given preorder and in order transversals.
00:51
The root of the tree can be determined from the preorder transversal.
00:54
So let's construct the tree uisrunvety.
01:11
The post order transversal of the constructed tree is rsiyteniu.
01:22
Inserting into bst and avl tree, the binary search tree, inserting keys for the first binary search tree which is bst.
01:39
We have keys 7, 11, 12, 18, 21.
01:46
So the tree becomes 7, 11, 12, 18, 21.
01:55
Now the avl tree inserting keys 20, 30, 80, 40, 10, 60, 50, 70.
02:11
So the tree becomes 40, 20, 10, 30, 60, 50, 80, 70.
02:26
The big o complexity of building a bst.
02:41
The worst case complexity for building a bst of n nodes is 0, n to the power 2.
02:49
This worst case happens when the input elements are provided in a sorted, i .e.
02:55
Ascending or descending order.
03:03
Causing the tree to be unbalanced and degenerate into a linked list...