题目:传送门 方法一、递归 中序遍历:先遍历左子树,在遍历根节点,最后遍历右子树。比较经典的方法是递归。 /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeN ...
分类:
其他好文 时间:
2020-07-26 15:32:51
阅读次数:
67
快速排序的核心是先找到一个比较的基数,然后从左往右寻找比基数大的值,从右往左找到比基数小的值,最后交换数据 public static void quickSort(int left,int right,int[]arr){ // 获取最左边的索引和最右边的索引 int l=left; int r= ...
分类:
编程语言 时间:
2020-07-26 11:17:03
阅读次数:
91
A tree is a well-known data structure that is either empty (null, void, nothing) or is a set of one or more nodes connected by directed edges between ...
分类:
其他好文 时间:
2020-07-26 02:05:42
阅读次数:
102
#include <stdio.h> #include <graphics.h> #include <stdlib.h> #include <dos.h> /*引用的库函数*/ #define LEFT 0x4b00 #define RIGHT 0x4d00 #define DOWN 0x5000 ...
分类:
编程语言 时间:
2020-07-26 02:05:25
阅读次数:
127
考察二叉树的遍历。判断前序遍历,与新增的前->右->左遍历结果是否一致。 C++版 #include <iostream> #include <algorithm> using namespace std; // 定义二叉树 struct TreeNode{ int val; struct Tree ...
分类:
其他好文 时间:
2020-07-26 01:57:55
阅读次数:
63
test-align 设置元素内文本的对齐方式,该属性对块级元素设置有效 语法(justify 两端对齐) text-align: left right center justify ...
分类:
其他好文 时间:
2020-07-26 01:56:41
阅读次数:
62
使用ngx_http_limit_req_module限制用户访问 该模块使用的是漏斗算法来进行限制。 官方的配置示例如下: http { limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s; ... server { ... loca ...
分类:
其他好文 时间:
2020-07-26 01:34:48
阅读次数:
78
快速排序 才发现自己配置好差,最坏情况10000就堆栈溢出了。。。。。 # coding: utf-8 import random import sys sys.setrecursionlimit(100000000) def quick_sort(li, left, right): if left ...
分类:
编程语言 时间:
2020-07-26 01:15:00
阅读次数:
65
题目链接 https://leetcode-cn.com/problems/merge-two-binary-trees/ 题解 递归解法 解法见代码注释 // Problem: LeetCode 617 // URL: https://leetcode-cn.com/problems/merge- ...
分类:
其他好文 时间:
2020-07-26 01:03:49
阅读次数:
54
$ancient_browser 如果浏览器被识别为旧式浏览器,该值等于 ancient_browser_value 的值 $arg_{name} 请求中某个参数值 $args 请求url里的参数 $binary_remote_addr (ngx_http_core_module,ngx_strea ...
分类:
其他好文 时间:
2020-07-26 00:44:12
阅读次数:
114