不带圆圈的二叉树

复制代码
    \begin{tikzpicture}[
        level 1/.style={sibling distance=2.2cm, level distance=0.8cm},  % 第1层子节点之间水平间距2.6cm,第一层和第二层之间高度1cm
        level 2/.style={sibling distance=1.2cm, level distance=0.8cm}, % 第2层子节点间距
        level 3/.style={sibling distance=1.2cm, level distance=0.8cm},
        line width=0.7pt,
        % 普通节点样式(带圆圈)
        node style/.style={
            circle, draw, minimum size=1.7em,
            line width=0.7pt, inner sep=2.5pt
        },
        % NULL节点样式(无圆圈)
        null node/.style={minimum size=1.7em}
    ]
            % 根节点A(普通样式)
    \node[node style] (A) {\ttfamily A}
    % 子节点B(普通样式)
    child {node[node style] (B) {\ttfamily B}
        child {node[null node] {\ttfamily NULL}}  % NULL无圆圈
        child {node[null node] {\ttfamily NULL}}
    }
    child {node[node style] (C) {\ttfamily C}
        child {node[null node] {\ttfamily NULL}}
        child {node[node style] (D) {\ttfamily D}
            child {node[null node] {\ttfamily NULL}}
            child {node[null node] {\ttfamily NULL}}
        }
    };
    \end{tikzpicture} 

代码运行生成的图如下:

相关推荐
雨中飘荡的记忆1 天前
ElasticJob分布式调度从入门到实战
java·后端
掘金安东尼1 天前
让 JavaScript 更容易「善后」的新能力
前端·javascript·面试
掘金安东尼1 天前
用 HTMX 为 React Data Grid 加速实时更新
前端·javascript·面试
灵感__idea1 天前
Hello 算法:众里寻她千“百度”
前端·javascript·算法
yinuo1 天前
轻松接入大语言模型API -04
前端
袋鼠云数栈UED团队1 天前
基于 Lexical 实现变量输入编辑器
前端·javascript·架构
cipher1 天前
ERC-4626 通胀攻击:DeFi 金库的"捐款陷阱"
前端·后端·安全
UrbanJazzerati1 天前
非常友好的Vue 3 生命周期详解
前端·面试
AAA阿giao1 天前
从零构建一个现代登录页:深入解析 Tailwind CSS + Vite + Lucide React 的完整技术栈
前端·css·react.js
亦妤1 天前
JS执行机制、作用域及作用域链
javascript