<svg width="800" height="400" viewBox="0 0 800 400" xmlns="http://www.w3.org/2000/svg">
  <!-- 定义箭头样式 -->
  <defs>
    <marker id="arrowhead" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">
      <polygon points="0 0, 10 3.5, 0 7" fill="black" />
    </marker>
  </defs>

  <!-- 背景和通用样式 -->
  <style>
    .node-text { font-family: "Times New Roman", serif; font-size: 26px; fill: black; text-anchor: middle; }
    .small-text { font-family: "Times New Roman", serif; font-size: 22px; fill: black; text-anchor: middle; }
    .sup { font-size: 16px; baseline-shift: super; }
    rect { stroke: black; stroke-width: 1.5; }
    line { stroke: black; stroke-width: 2; marker-end: url(#arrowhead); }
  </style>

  <!-- 第一层：顶层节点 -->
  <rect x="200" y="30" width="400" height="55" fill="#ffebeb" />
  <text x="400" y="67" class="node-text">population count of 4 bits</text>

  <!-- 第二层：中间节点 -->
  <!-- 左侧 -->
  <rect x="120" y="180" width="275" height="45" fill="#e8e8ff" />
  <text x="257" y="212" class="node-text">sum of bits 1 &amp; 2</text>

  <!-- 右侧 -->
  <rect x="405" y="180" width="275" height="45" fill="#e8e8ff" />
  <text x="542" y="212" class="node-text">sum of bits 3 &amp; 4</text>

  <!-- 第三层：底层节点 -->
  <!-- 1st bit -->
  <rect x="130" y="320" width="115" height="50" fill="#ffffd1" />
  <text x="187" y="355" class="small-text">1<tspan class="sup">st</tspan> bit</text>

  <!-- 2nd bit -->
  <rect x="268" y="320" width="120" height="50" fill="#ffffd1" />
  <text x="328" y="355" class="small-text">2<tspan class="sup">nd</tspan> bit</text>

  <!-- 3rd bit -->
  <rect x="412" y="320" width="115" height="50" fill="#ffffd1" />
  <text x="469" y="355" class="small-text">3<tspan class="sup">rd</tspan> bit</text>

  <!-- 4th bit -->
  <rect x="555" y="320" width="115" height="50" fill="#ffffd1" />
  <text x="612" y="355" class="small-text">4<tspan class="sup">th</tspan> bit</text>

  <!-- 连接线（箭头） -->
  <!-- 底层到中层 -->
  <line x1="197" y1="320" x2="245" y2="232" /> <!-- 1st to sum12 -->
  <line x1="328" y1="320" x2="270" y2="232" /> <!-- 2nd to sum12 -->
  <line x1="482" y1="320" x2="530" y2="232" /> <!-- 3rd to sum34 -->
  <line x1="612" y1="320" x2="555" y2="232" /> <!-- 4th to sum34 -->

  <!-- 中层到顶层 -->
  <line x1="280" y1="180" x2="370" y2="92" /> <!-- sum12 to root -->
  <line x1="520" y1="180" x2="430" y2="92" /> <!-- sum34 to root -->
</svg>
