二叉树的构建与遍历(最简单的二叉树)
#include <iostream>
using namespace std;
**//****定义节点的类模板。二叉树的节点是一个类的实例,该类由一个信息成员和两个指针成员组成*****
template <typename T>
class binaryTreeNode
{
public:
T element;
binaryTreeNode<T> *leftchild;
binaryTreeNode<T> *rightchild;
binaryTreeNode()
二叉树的先序,中序,后序遍历举例
eg1: 前序遍历:ABCDEFGHK
中序遍历:BDCAEHGKF
后序遍历:DCBHKGFEA
eg2: 前序遍历:1 2 4 5 7 8 3 6
中序遍历:4 2 7 5 8 1 3 6
后序遍历:4 7 8 5 2 6 3 1
层次遍历:1 2 3 4 5 6 7 8
100.Same Tree
description: Given two binary trees, write a function to check if they are the same or not. Two binary trees are considered the same if they are structurally identical and the nodes have the same value. Example 1: Input: 1 1 / \ / 2 3 2 3 [1,2,3
107. Binary Tree Level Order Traversal II(二叉树广度遍历,自底向上输出)
problems: Given a binary tree, return the bottom-up level order traversal of its nodes’ values. (ie, from left to right, level by level from leaf to root). For example: Given binary tree [3,9,20,null,null,15,7], 3
/ \
9 20
/ \
15
c++中vector初始化问题,push_back
一.在c++中使用vector时一般不会指定它的容量大小,因为vector在运行时能高效快速地添加元素。通常都是开始的时候创建空的vector对象,在运行时再动态添加元素。vector中push_back添加元素时,是在末尾添加。 #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
vector<int> res;
for(int i=0;i<1
112.Path Sum
problems: Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. Note: A leaf is a node with no children. Example: Given the below binary tree and sum = 22
CSS Table合并单元格
版权声明:@今年依旧12岁 https://blog.csdn.net/qq_34087199/article/details/88567205 colspan:左右合并单元格的个数; 用法:colspan=“3” 横向合并三个单元格‘。 rowspan:上下合并单元格的个数; 用法:rowspan="3"垂直合并三个单元格。 <table>
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Subject</th
CSS Radio控件
版权声明:@今年依旧12岁 https://blog.csdn.net/qq_34087199/article/details/88572222 1. 获取选中的radio的值: <div class="col-md-2 radio">
<label><input type="radio" name="AMorPM" id="AM" value="AM" checked>AM</label>
<label><input type="radio" name="AMorPM" id="PM"
Bootstrap datetimepicker控件
版权声明:@今年依旧12岁 https://blog.csdn.net/qq_34087199/article/details/88573021 List item控件使用: Bootstrap datetimepicker 官方API <div class="col-md-2">
<label for="date" class="text-right fix-width">Date:</label>
<input size="16" type="text" id="date" value
X+一个数为平方根,X+另一个数还为平方根
版权声明:@今年依旧12岁 https://blog.csdn.net/qq_34087199/article/details/88578172 因式分解算法 int element = Num; //用于因式分解的数
int flag = element;
Dictionary<int, int> factor = new Dictionary<int, int>(); //Value>Key
for (int i = 1; i < flag ; i++)
{
if (elem
Python安装包的步骤
版权声明:@今年依旧12岁 https://blog.csdn.net/qq_34087199/article/details/88948140 pip isntall + 包名 如果直接安装失败 先在网上下载要安装的包(.whl文件) Python包的下载地址:https://pypi.org/ cd 到本地文件夹 ->pip install + 包名 或者: pip install -e + 本地 setup.py文件的路径
对Config文件的操作
版权声明:@今年依旧12岁 https://blog.csdn.net/qq_34087199/article/details/89490985 <?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="" value=""/>
</appSettings>
</configuration>
using System.Configuration
//获取key值
st
FileStream类
FileStream类 对流进行操作时要引用 using System.IO; 命名空间 FileStream常用的属性和方法:
属性:
CanRead 判断当前流是否支持读取,返回bool值,True表示可以读取
CanWrite 判断当前流是否支持写入,返回bool值,True表示可以写入
方法:
Read() 从流中读取数据,返回字节数组
Write() 将字节块(字节数组)写入该流
Seek() 设置文件读取或写入的起始位置
Flush() 清除该流缓冲区,使得
关于Dictionary类、List类的学习与应用
版权声明:@今年依旧12岁 https://blog.csdn.net/qq_34087199/article/details/88573757 概述:Dictionary类和List类都是抽象类 1. dictionary类 定义:用来存储键/值对 Dictionary<string,string> dic=new Dictionary<string,string>;
属性: // 在JS中,Dictionary类没有length属性,获取dictionary的length
var arr
App自动化(2)--Python&Appium实现安卓手机九宫格解锁
九宫格作为常见的手势密码,我们在使用的时候,是从起点开始,按住不放,然后滑动手指,直到最后一个点松开手指,如果与设置的手势密码匹配,则解锁成功。 现在大多数九宫格作为一个元素存在,很难定位到每一个点。 解决思路有两个,一是用指针定位每一个点;二是先获取元素坐标位置,再获取元素大小,然后切割图片,分别计算出每个点的坐标; 本次笔记记录第一个解决思路: 目的:创建一个Unlock类,按顺序传入九宫格的解锁数字即可实现主屏幕解锁 模拟器:夜神 1、坐标定位到每个点 A、夜神模拟器开发者选项中开启指针
消息中间件——activeMQ
Activemq使用教程 解压activmq进入bin\win64 启动activemq.bat 启动成功 浏览器访问http://127.0.0.1:8161 创建maven工程 在pom.xml中添加依赖 <dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-all</artifactId>
<version>5.15.8</version>
</depende
今日推荐
周排行