私は次のバイナリツリーを持っています。これは、ツリーの回転の最小回数を使ってターゲットバイナリツリー(ポストの2番目のツリー)に変換しようとしています。このツリーの理論回転数の最小値は5ですが、最小値は6回転です。ローテーションもコピーしました。何が欠けていますか?2つのバイナリツリー間の回転距離
ツリー: 1 \ \ 3 /\ / \ 2 5 / \ / \ 4 7 / \ / \ 6 11 /\ / \ 9 12 /\ 8 10
ターゲットツリー:私は(6つの回転を必要とすべてが)これまでに試してみました 1 \ \ 11 / \ / \ 9 12 /\ / \ 3 10 /\ / \ 2 5 /\ / \ 4 7 /\ 6 8
回転:
Order1: Rotate left with root 7 and pivot 11 Rotate left with root 5 and pivot 11 Rotate left with root 3 and pivot 11 Rotate left with root 7 and pivot 9 Rotate left with root 5 and pivot 9 Rotate left with root 3 and pivot 9
Order2: Rotate left with root 7 and pivot 11 Rotate left with root 5 and pivot 11 Rotate left with root 7 and pivot 9 Rotate left with root 3 and pivot 11 Rotate left with root 5 and pivot 9 Rotate left with root 3 and pivot 9
Order3: Rotate left with root 7 and pivot 11 Rotate left with root 5 and pivot 11 Rotate left with root 7 and pivot 9 Rotate left with root 5 and pivot 9 Rotate left with root 3 and pivot 11 Rotate left with root 3 and pivot 9
Order4: Rotate left with root 7 and pivot 11 Rotate left with root 7 and pivot 9 Rotate left with root 5 and pivot 11 Rotate left with root 3 and pivot 11 Rotate left with root 5 and pivot 9 Rotate left with root 3 and pivot 9
Order5:
Rotate left with root 7 and pivot 11 Rotate left with root 7 and pivot 9 Rotate left with root 5 and pivot 11 Rotate left with root 5 and pivot 9 Rotate left with root 3 and pivot 11 Rotate left with root 3 and pivot 9