效果图如下: 参考GitHub来实现的,更详细的源码以及参数说明见:GitHub 本篇文章的html源码: <!DOCTYPE html> <html> <head> <title>openlayers6结合echarts4实现迁徙图</title> <link rel="stylesheet" h ...
分类:
其他好文 时间:
2020-07-26 15:58:57
阅读次数:
124
「APIO2018」选圆圈(K-D Tree/CDQ+Set) Part1 K-D Tree做法 K-D Tree经常用来优化大暴力。。 把圆$(x,y,r)\(视为矩形\)(x-r,y-r,x+r,y+r)\(,依据\)(x,y)$构建K-D Tree 维护K-D Tree每个节点所有矩形最小和最 ...
题目链接: P2633 Count on a tree solution: LCA好题.询问第k大,不难想到主席树和前缀和思想,对于每个点$x$,我们可以用主席树维护root到$x$上的序列,然后查询$x,y$路径上的第$k$小只需要用前缀和维护权值线段树,用$x+y-lca(x,y)-f[lca( ...
分类:
其他好文 时间:
2020-07-26 15:45:20
阅读次数:
73
题目:传送门 方法一、递归 中序遍历:先遍历左子树,在遍历根节点,最后遍历右子树。比较经典的方法是递归。 /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeN ...
分类:
其他好文 时间:
2020-07-26 15:32:51
阅读次数:
67
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
考察二叉树的遍历。判断前序遍历,与新增的前->右->左遍历结果是否一致。 C++版 #include <iostream> #include <algorithm> using namespace std; // 定义二叉树 struct TreeNode{ int val; struct Tree ...
分类:
其他好文 时间:
2020-07-26 01:57:55
阅读次数:
63
lists = [1,3,4,5,6,7,9,2]# 切片print lists[::-1]# 函数reverse 对数组进行操作lists.reverse() print lists# 函数reversed 返回一个迭代对象,需要list化print list(reversed(lists)) ...
分类:
编程语言 时间:
2020-07-26 00:56:00
阅读次数:
65
题目链接 https://leetcode-cn.com/problems/invert-binary-tree/ 题解 递归解法 // Problem: LeetCode 226 // URL: https://leetcode-cn.com/problems/invert-binary-tree ...
分类:
其他好文 时间:
2020-07-26 00:43:25
阅读次数:
55
需求是这样的: 我需根据不同情况,初始化一个大小不同的数组,做开始的想法是通过 if--else,但是发现写出来不好看。不符合个人习惯。所以想着优化一下。 数据为Demo数据,没有实际意义 我的想法是这样的; 将逻辑判断写到初始化数组的[] 里,使用三元运算符实现 具体实现是这样的; ...
分类:
编程语言 时间:
2020-07-26 00:30:31
阅读次数:
68
链接:https://leetcode-cn.com/problems/convert-sorted-list-to-binary-search-tree/ 代码 /** * Definition for singly-linked list. * struct ListNode { * int v ...
分类:
其他好文 时间:
2020-07-26 00:07:52
阅读次数:
59