- 博客(2)
- 收藏
- 关注
原创 C/C++ 树的基本概念
1.理解二叉树1.1基本概念根节点;左子树指针,右子树指针,孩子结点,父结点,兄弟结点;2.二叉树的遍历#include <stdio.h>#include <stdlib.h>typedef struct treeNode{ char data;//存放结点数据 struct treeNode* Lchild; struct treeNode* Rchild;}TREE,*LPTREE;//创建结点LPTREE createNode(char data)
2021-12-21 00:27:07
2114
原创 二叉树的中序遍历
二叉树的中序遍历给定一个二叉树的根节点 root ,返回它的 中序 遍历。示例 1:输入:root = [1,null,2,3]输出:[1,3,2]//首先定义树的结构,Definition for a binary tree node.struct TreeNode{ int val; TreeNode *left;//定义树的左节点属性 TreeNode *right; TreeNode(): val(0),left(nullptr),right(nullptr){} TreeN
2021-12-19 22:52:58
569
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人