If the two lists have same elements, then these *can* produce identical BSTs. as for any list, there are number of ways to construct a BST, probably you meant a balanced BST, though even that might not be unique.

so in my opinion, we just need to check if the two lists have identical elements, which we cab easily do in O(n lgn)

-Vijju

On 10/31/06, ravi <[EMAIL PROTECTED]> wrote:

suppose we have two lists L1, L2 , How will we check whether these two
lists producing the identical BST's or not, without constructing the
BST's.

EX:

L1 = { 10, 5, 15 } , L2 = { 10, 15 , 5 }
will produce identical binary trees as
        10
  5            15

Is there any algo. to find this?






--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups-beta.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---

Reply via email to