普通文件类型Linux中最多的一种文件类型, 包括 纯文本文件(ASCII);二进制文件(binary);数据格式的文件(data);各种压缩文件.第一个属性为 [-] 目录文件就是目录, 能用 # cd 命令进入的。第一个属性为 [d],例如 [drwxrwxrwx] 块设备文件块设备文件 : 就 ...
分类:
系统相关 时间:
2020-12-10 11:40:41
阅读次数:
15
初一看,sb题,上去一个并查集,很快啊,返回一个MLE,定睛一看,系统开的内存很小,但是这个算法复杂度又是这么正确 因此考虑优化内存,这样用滚动数组优化即可 #include<bits/stdc++.h> using namespace std; typedef long long ll; type ...
分类:
其他好文 时间:
2020-12-10 11:39:56
阅读次数:
13
问题: 给定一颗BST(二叉搜索树),其中存在两个节点顺序颠倒,请找出他们,并恢复正确次序。 Example 1: Input: root = [1,3,null,null,2] Output: [3,1,null,null,2] Explanation: 3 cannot be a left ch ...
分类:
其他好文 时间:
2020-12-09 12:24:32
阅读次数:
5
有人说,90%的程序员都手写不出正确的二分查找 没错,我就是那90% c++的标准库里只提供了binary_search(),lower_bound(),upper_bound()三个函数,缺点就是,只能在数组或者vector这样的线性数据结构上二分 所以就需要整理一下二分的用法和代码 1,bina ...
分类:
其他好文 时间:
2020-12-04 11:17:31
阅读次数:
5
给定一个二叉树,判断它是否是高度平衡的二叉树。 本题中,一棵高度平衡二叉树定义为: 一个二叉树每个节点 的左右两个子树的高度差的绝对值不超过 1 。 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/balanced-binary-tree 著作 ...
分类:
其他好文 时间:
2020-12-03 11:59:09
阅读次数:
6
link /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NUL ...
分类:
其他好文 时间:
2020-11-27 11:14:59
阅读次数:
5
/** * Definition for a binary tree node. * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * }; */ /** * Return an arr ...
分类:
其他好文 时间:
2020-11-26 14:41:52
阅读次数:
8
You are given a perfect binary tree where all leaves are on the same level, and every parent has two children. The binary tree has the following defin ...
分类:
其他好文 时间:
2020-11-20 12:00:39
阅读次数:
9
二分搜索简介 在计算机科学中,二分搜索(binary search)也称折半搜索(half-interval search)、对数搜索(logarithmic search),是在有序数组中查找某一特定元素的搜索算法。 其基本思想是通过逐次比较数组特定范围的中间元素与目标元素的大小,每次缩小一半的搜 ...
分类:
其他好文 时间:
2020-11-12 13:35:55
阅读次数:
9
题目 代码 /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NU ...
分类:
其他好文 时间:
2020-11-10 10:47:27
阅读次数:
5