分治策略 1)将问题分解为规模较小的子问题,子问题与原问题同质 2)迭代或者递归解决每个子问题 3)将子问题的解综合得到原问题解 例子:二分查找Binary Search 1 BinarySearch(T,l,r,x) 2 //输入数组T,下标从l到r,查找数x 3 //输出j,若x在T中输出下标, ...
分类:
编程语言 时间:
2020-03-16 13:17:50
阅读次数:
61
【Unity加载二进制数据】 The first step is to save your binary data file with the ".bytes" extension. Unity will treat this file as a TextAsset. As a TextAsset ... ...
分类:
编程语言 时间:
2020-03-16 09:18:31
阅读次数:
132
1.pathSum 1 class TreeNode: 2 def __init__(self,x): 3 self.val=x 4 self.left=None 5 self.right=None 6 7 8 class Solution: 9 def dfs(self,root,target,p ...
分类:
其他好文 时间:
2020-03-15 22:26:11
阅读次数:
54
原文:ASP.NET WebAPI框架解析第二篇(HttpModule的创建和使用) 我们先看一下执行流程图图中画红圈的部分便是HttpModule,在说创建HttpModule之前,先说一下HttpApplication对象,HttpApplication对象由Asp.net框架创建,每个请求对应... ...
1 二叉排序树/二叉查找树/Binary Sort Tree + 1种对排序和查找都很有用的特殊二叉树 + 叉排序树的弊端的解决方案:平衡二叉树 + 二叉排序树必须满足的3条性质(或是具有如下特征的二叉树) + 若它的左子树不为空,则:左子树上所有结点的值< 它根结点的值 + 若它的右子树不为空,则 ...
分类:
编程语言 时间:
2020-03-15 13:28:13
阅读次数:
87
题目描述: https://leetcode-cn.com/problems/binary-tree-level-order-traversal/ 给定一个二叉树,返回其按层次遍历的节点值。 (即逐层地,从左到右访问所有节点)。 例如:给定二叉树: [3,9,20,null,null,15,7], ...
分类:
其他好文 时间:
2020-03-14 11:03:16
阅读次数:
49
300. Longest Increasing Subsequence(最长上升子序列) 链接 https://leetcode cn.com/problems/merge two binary trees 题目 给定一个无序的整数数组,找到其中最长上升子序列的长度。 示例: 输入: [10,9,2 ...
分类:
其他好文 时间:
2020-03-14 10:48:26
阅读次数:
54
给定一个二叉树,返回它的 后序 遍历。 示例: 输入: [1,null,2,3] 1 \ 2 / 3 输出: [3,2,1] /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *lef ...
分类:
其他好文 时间:
2020-03-14 00:39:36
阅读次数:
75
UTF-8 中的一个字符可能的长度为 1 到 4 字节,遵循以下的规则: 对于 1 字节的字符,字节的第一位设为0,后面7位为这个符号的unicode码。对于 n 字节的字符 (n > 1),第一个字节的前 n 位都设为1,第 n+1 位设为0,后面字节的前两位一律设为10。剩下的没有提及的二进制位 ...
分类:
其他好文 时间:
2020-03-13 20:48:51
阅读次数:
88
226. Invert Binary Tree(翻转二叉树) 链接 https://leetcode cn.com/problems/invert binary tree 题目 翻转一棵二叉树。 示例: 输入: 4 / \ 2 7 / \ / \ 1 3 6 9 输出: 4 / \ 7 2 / \ ...
分类:
其他好文 时间:
2020-03-13 20:30:09
阅读次数:
43