[LeetCode]Minimum Depth of Binary Tree Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node. 递归和非递归,此提比较简单.广度优先遍历即可.关键之处就在于如何保持访问深度. 下面是4种代码: im…
Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node. 递归的解题思路: 递归当前结点,分一下四种情况考虑:①结点为空时返回0:②结点没有右子树时,返回左子树最小值+1:③结点没有左子树时,返回右子树最小值+1:④当结点双子齐全时,返回…
use TTgoif exists (select * from sysobjects where name='Tonge')drop table Tongecreate table Tonge( ID int primary key identity(1,1), NAME varchar(100), PWD varchar(100), PHONE varchar(100), BORNDATE date default getDate())go --存储过程插入10万条数据耗时:38s//平均 …
首现创建一张表,然后插入1000+万条数据,接下来进行测试. use TTgoif exists (select * from sysobjects where name='Tonge')drop table Tongecreate table Tonge( ID int primary key identity(1,1), NAME varchar(100), PWD varchar(100), PHONE varchar(100), BORNDATE date default getDate…