HI , consider that each value could be the root. Recursively find the size of the left and right subtrees. thats it .
lets try for n=2 e.g. 1,2 there ways to select the root wither 1 or 2 , if u choose one , size of left subtree will be 0 & size of right subtree will be 1 so , similarly if u choose 2 as root , size of left subtree will be 1 and size of right subtree will be 0 , so tottal no of BST will 2 . dats what * **( combinatorics says , either select one or leave it , try to next element ) ** *now try for n=3 e.g. 1,2,3 values how many bst can created then try to implement this algorithm , fell free to drop me message . if i missed something or any clarification *Thanks Shashank Mani Narayan Computer Science & Engineering Birla Institute of Technology,Mesra ** Founder Cracking The Code Lab "http://shashank7s.blogspot.com/" FB Page http://www.facebook.com/pages/Cracking-The-Code/148241881919895 Google+ http://gplus.to/wgpshashank Twitter "https://twitter.com/wgpshashank<https://twitter.com/#%21/wgpshashank> " Puzzled Guy @ "http://ashutosh7s.blogspot.com"** **FB Page http://www.facebook.com/Puzzles.For.Puzzled.Minds* . -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/KqUTHeMkPuwJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.