Leetcode 1305: All Elements in Two Binary Search Trees (Leetcode medium, Amazon)

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

There is an error (around 4:20 of the video). If there are n nodes across both trees then the space complexity will be O(n) not O(log n) as you stated. Remember in the worst case the Binary Tree can end up being a linked list. Also you mentioned that the recursion takes O(log n) which is not true, using the same rationale. The traversal will take O(n) time in total. Appreciate the videos.

karllopes
join shbcf.ru