How to convert a binary tree to binary search tree in-place, i.e., we cannot use any extra space

前端 未结 11 1122
借酒劲吻你
借酒劲吻你 2021-01-31 22:12

How to convert a binary tree to binary search tree in-place, i.e., we cannot use any extra space.

11条回答
  •  醉话见心
    2021-01-31 22:30

    A binary tree usually is a binary search tree, in which case no conversion is required.

    Perhaps you need to clarify the structure of what you are converting from. Is your source tree unbalanced? Is it not ordered by the key you want to search on? How did you arrive at the source tree?

提交回复
热议问题