Permutations Of BST

Правка en1, от gXa, 2016-07-17 10:41:48

Hi everyone, I am trying to find all permutations of the input elements which will result in the same Binary Search tree as the one formed with the input array.

Eg: I/P: 4, 3, 1, 2, 6, 5, 7

o/p:4 , 6, 3, 7, 5, 1, 2 4, 3, 2, 1, 6, 5, 7

and so on.

I have gone through links on internet but could not code it.

I am unable to print all the permutations correctly. So, I request community to help me with logic ( if recurive function can be provided too )?

Thank You

Теги bst

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский gXa 2016-07-17 10:42:39 6 Tiny change: '5, 1, 2 \n4, 3, 2, 1' -
en1 Английский gXa 2016-07-17 10:41:48 510 Initial revision (published)