#221

Поделиться
HTML-код
  • Опубликовано: 27 окт 2024

Комментарии • 3

  • @sauravchandra10
    @sauravchandra10 3 месяца назад

    Can we do this without taking extra space to store the inorder traversal of root1 and root2?

    • @maskedcoder-dy1ub
      @maskedcoder-dy1ub  3 месяца назад

      Tried it
      Couldn't find a way

    • @sauravchandra10
      @sauravchandra10 3 месяца назад

      @@maskedcoder-dy1ub we can use the concept of merging 2 BST into 1 BST and then finding the inorder.
      We will first convert both the trees into sorted LL, merge these two sorted LLs into one sorted LL and then create a new tree using the merged list.