此博客链接:https://www.cnblogs.com/ping2yingshi/p/12907812.html 二叉树的最大深度(59min) 题目链接:https://leetcode-cn.com/problems/maximum-depth-of-binary-tree/ 给定一个二叉树 ...
分类:
其他好文 时间:
2020-05-18 01:09:22
阅读次数:
126
题目: 二叉搜索树迭代器:实现一个二叉搜索树迭代器。你将使用二叉搜索树的根节点初始化迭代器。 调用 next() 将返回二叉搜索树中的下一个最小的数。 思路: 二叉搜索树使用中序,然后弹出栈底。 程序: # Definition for a binary tree node. # class Tre ...
分类:
编程语言 时间:
2020-05-16 10:55:17
阅读次数:
70
题目: 二叉树的锯齿形层次遍历:给定一个二叉树,返回其节点值的锯齿形层次遍历。(即先从左往右,再从右往左进行下一层遍历,以此类推,层与层之间交替进行)。 思路: 使用层序遍历的思路,但是没有用到栈。 程序: # 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:递归 # Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # ...
分类:
编程语言 时间:
2020-05-15 18:33:37
阅读次数:
63
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
MySQL官方对索引的定义为:索引是帮助MySQL高效获取数据的数据结构。 索引的本质:索引是数据结构,可以简单的理解为“排好序的快速查找B+树数据结构” B+树:B代表平衡(balance)而不是二叉(binary) 检索原理: mysql索引结构: BTREE: B树(Balance Tree多 ...
分类:
数据库 时间:
2020-05-14 01:14:41
阅读次数:
72