题目: 二叉树的锯齿形层次遍历:给定一个二叉树,返回其节点值的锯齿形层次遍历。(即先从左往右,再从右往左进行下一层遍历,以此类推,层与层之间交替进行)。 思路: 使用层序遍历的思路,但是没有用到栈。 程序: # Definition for a binary tree node. # class T ...
分类:
编程语言 时间:
2020-05-16 10:35:55
阅读次数:
103
COMMON OPERATORS IN C Unary Operators: take only one argument e.g. unary -, unary +, ++, --, ! (-2), (+2), a++, a--, !done Binary Operators: take two ...
分类:
其他好文 时间:
2020-05-16 09:23:53
阅读次数:
80
题目: 二叉树的后序遍历:给定一个二叉树,返回它的 后序 遍历。 思路: 递归大法好,之后补充使用栈来实现的。 程序1:递归实现 # Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # sel ...
分类:
编程语言 时间:
2020-05-15 20:29:29
阅读次数:
88
1.Linux连接外网。 2.安装gcc 安装gcc-c++ [root@localhost ~]# yum -y install gcc [root@localhost ~]# yum -y install gcc-c++ 3.验证gcc是否安装成功 [root@localhost ~]#gcc ...
分类:
其他好文 时间:
2020-05-15 20:22:03
阅读次数:
60
题目: 二叉树的前序遍历:给定一个二叉树,返回它的 前序 遍历。 思路: 思路一使用老套路递归,思路二会补充使用栈的程序。 程序1:递归 # Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # ...
分类:
编程语言 时间:
2020-05-15 18:33:37
阅读次数:
63
1.redis安装 1.下载安装包 将redis-5.0.2.tar.gz放到opt目录下 2.解压源码包 [root@CentOS7 opt]# tar -zxvf redis-5.0.2.tar.gz #解压会生成一个redis-5.0.5的目录 3.安装GCC依赖 [root@CentOS7 ...
分类:
其他好文 时间:
2020-05-15 15:57:00
阅读次数:
66
Given a sorted (in ascending order) integer array nums of n elements and a target value, write a function to search target in nums. If target exists, ...
分类:
其他好文 时间:
2020-05-15 09:23:28
阅读次数:
56
给定一个字符串 s,计算具有相同数量0和1的非空(连续)子字符串的数量,并且这些子字符串中的所有0和所有1都是组合在一起的。 重复出现的子串要计算它们出现的次数。 来源:力扣(LeetCode) class Solution { public: int countBinarySubstrings(s ...
分类:
其他好文 时间:
2020-05-14 11:26:04
阅读次数:
58
1.内存的增长主要在binary上 1.binary有两处存储位置 --1. size <= 64 字节(bytes)时,存储在进程的单独heap中,bianry叫做Heap-binary。 --2. size > 64 字节(bytes)时,存储在虚拟机分配出来的单独heap中,bianry叫做R ...
分类:
其他好文 时间:
2020-05-14 10:48:28
阅读次数:
76
一、安装redis 第一步:下载redis安装包 wget http://download.redis.io/releases/redis-4.0.6.tar.gz 第二步:解压压缩包 tar -zxvf redis-4.0.6.tar.gz 第三步:yum安装gcc依赖 yum install g ...
分类:
其他好文 时间:
2020-05-14 01:44:46
阅读次数:
58