CLRS의 병합 다이어그램과 비슷한 작업을 수행하려고 합니다.

CLRS의 병합 다이어그램과 비슷한 작업을 수행하려고 합니다.

죄송합니다. 최적의 해상도는 아닙니다. 정확할 필요는 없습니다. 제안을 찾고 있습니다. 병합

답변1

이러한 나무는 forest.

\documentclass{article}
\usepackage[edges]{forest}
\begin{document}
\begin{forest}
for tree={draw,fill=gray!20,s sep+=6ex,l sep+=2ex,math content,
edge={stealth-,very thick,shorten >=3pt,shorten <=3pt},
where n children={0}{}{label={[yshift=-2.5ex,font=\small\sffamily]below:merge}}}
[{1~~2~~2~~3~~4~~5~~6~~6}
 [{2~~4~~5~~6}
  [{2~~5}
   [5]
   [2]
  ]
  [{4~~6}
   [4]
   [6]
  ]
 ]
 [{1~~2~~3~~6}
  [{1~~3}
   [1]
   [3]
  ]
  [{2~~6}
   [2]
   [6]
  ]
 ]
]
\path (current bounding box.north) node[above=0.5ex] {sorted sequence}
(current bounding box.south) node[below=0.5ex] {initial sequence};
\end{forest}
\end{document}

여기에 이미지 설명을 입력하세요

관련 정보