1
0

00-Splay-01-旋转不改中序.svg 2.2 KB

123456789101112
  1. <svg xmlns="http://www.w3.org/2000/svg" width="930" height="300" viewBox="0 0 930 300">
  2. <style>.t{font:16px sans-serif;fill:#1f2937}.s{font:13px sans-serif;fill:#475569}.n{fill:#fff;stroke:#2563eb;stroke-width:3}.e{stroke:#64748b;stroke-width:3}.a{stroke:#16a34a;stroke-width:4}.sub{fill:#eff6ff;stroke:#60a5fa;stroke-width:2}</style>
  3. <rect width="930" height="300" fill="#f8fafc"/><text x="32" y="35" class="t" font-weight="bold">左旋的证据:局部指针变了,中序 A,p,B,x,C 没变</text>
  4. <text x="180" y="70" class="s">旋转前</text><line x1="175" y1="105" x2="120" y2="180" class="e"/><line x1="175" y1="105" x2="250" y2="170" class="e"/><line x1="250" y1="170" x2="215" y2="240" class="e"/><line x1="250" y1="170" x2="300" y2="240" class="e"/>
  5. <circle cx="175" cy="105" r="23" class="n"/><circle cx="250" cy="170" r="23" class="n"/><rect x="95" y="180" width="50" height="32" rx="6" class="sub"/><rect x="190" y="240" width="50" height="32" rx="6" class="sub"/><rect x="275" y="240" width="50" height="32" rx="6" class="sub"/>
  6. <g class="t" text-anchor="middle"><text x="175" y="111">p</text><text x="250" y="176">x</text><text x="120" y="202">A</text><text x="215" y="262">B</text><text x="300" y="262">C</text></g>
  7. <path d="M382 155 H505" class="a" fill="none"/><path d="M505 155 l-15 -9 v18z" fill="#16a34a"/><text x="395" y="130" class="s">x 绕 p 上来</text>
  8. <text x="640" y="70" class="s">旋转后</text><line x1="655" y1="105" x2="575" y2="170" class="e"/><line x1="655" y1="105" x2="730" y2="180" class="e"/><line x1="575" y1="170" x2="535" y2="240" class="e"/><line x1="575" y1="170" x2="620" y2="240" class="e"/>
  9. <circle cx="655" cy="105" r="23" class="n"/><circle cx="575" cy="170" r="23" class="n"/><rect x="510" y="240" width="50" height="32" rx="6" class="sub"/><rect x="595" y="240" width="50" height="32" rx="6" class="sub"/><rect x="705" y="180" width="50" height="32" rx="6" class="sub"/>
  10. <g class="t" text-anchor="middle"><text x="655" y="111">x</text><text x="575" y="176">p</text><text x="535" y="262">A</text><text x="620" y="262">B</text><text x="730" y="202">C</text></g>
  11. <text x="280" y="285" class="s">键范围:A &lt; p &lt; B &lt; x &lt; C;B 只是换到 p 的右边。</text>
  12. </svg>