Estou tentando fazer algo semelhante ao diagrama de mesclagem no CLRS

Estou tentando fazer algo semelhante ao diagrama de mesclagem no CLRS

Desculpe, não é a melhor resolução. Não precisa ser exato. Apenas procurando sugestões. Mesclar

Responder1

Essas árvores podem ser produzidas com 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}

insira a descrição da imagem aqui

informação relacionada