| 1234567891011 |
- <svg xmlns="http://www.w3.org/2000/svg" width="930" height="330" viewBox="0 0 930 330">
- <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}.badge{fill:#dbeafe;stroke:#2563eb;stroke-width:2}.key{fill:#fff7ed;stroke:#ea580c;stroke-width:2}</style>
- <rect width="930" height="330" fill="#f8fafc"/><text x="30" y="34" class="t" font-weight="bold">隐式树的“键”藏在中序位置;value 即使重复也不影响定位</text>
- <g class="e"><line x1="450" y1="78" x2="300" y2="170"/><line x1="450" y1="78" x2="610" y2="170"/><line x1="300" y1="170" x2="210" y2="260"/><line x1="300" y1="170" x2="375" y2="260"/><line x1="610" y1="170" x2="535" y2="260"/><line x1="610" y1="170" x2="700" y2="260"/></g>
- <g class="n"><circle cx="450" cy="78" r="28"/><circle cx="300" cy="170" r="28"/><circle cx="610" cy="170" r="28"/><circle cx="210" cy="260" r="28"/><circle cx="375" cy="260" r="28"/><circle cx="535" cy="260" r="28"/><circle cx="700" cy="260" r="28"/></g>
- <g class="t" text-anchor="middle"><text x="450" y="78">D</text><text x="300" y="170">B</text><text x="610" y="170">F</text><text x="210" y="260">A</text><text x="375" y="260">C</text><text x="535" y="260">E</text><text x="700" y="260">G</text></g>
- <g class="s" text-anchor="middle"><text x="450" y="99">size=7</text><text x="300" y="191">size=3</text><text x="610" y="191">size=3</text></g>
- <rect x="60" y="55" width="135" height="58" rx="8" class="key"/><text x="75" y="80" class="t">问:第 5 项?</text><text x="75" y="102" class="s">不比较字母大小</text>
- <path d="M195 95 H250" stroke="#ea580c" stroke-width="3"/><text x="60" y="155" class="s">根 D 左 size=3:</text><text x="60" y="177" class="s">5 > 3+1,去右</text><text x="60" y="199" class="s">并把 k 改为 1。</text>
- <text x="330" y="315" class="s">中序 A,B,C,D,E,F,G 才是位置 1..7;树形可转,顺序语义不转。</text>
- </svg>
|