序列化和反序列化代码如下 /// <summary> /// 将一个object对象序列化,返回一个byte[] /// </summary> public static byte[] ObjectToBytes(object obj) { using (MemoryStream ms = new  ...
                            
                            
                         
                    
                        
                            
                            
                                    # Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution:  ...
                            
                            
                                分类:
其他好文   时间:
2020-04-23 12:09:43   
                                阅读次数:
60
                             
                         
                    
                        
                            
                            
                                    题目描述 Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. According to the definition of LCA on Wikipedia: “The  ...
                            
                            
                                分类:
其他好文   时间:
2020-04-23 00:51:39   
                                阅读次数:
73
                             
                         
                    
                        
                            
                            
                                牛就一个字,我能说啥,一开始想到每次遍历最右边的节点,但又想到万一出现有一层只有左半部分的节点没有右半部分的节点就不好弄了,没想到可以用BFS遍历,每次取到最后一个数,腻害。 /** * Definition for a binary tree node. * public class TreeNo ...
                            
                            
                                分类:
其他好文   时间:
2020-04-23 00:31:47   
                                阅读次数:
50
                             
                         
                    
                        
                            
                            
                                    题目链接:https://leetcode-cn.com/problems/invert-binary-tree/ 思路一:递归 将左右结点进行交换,递归的对左右节点的左右子树进行交换 判断根结点是否为空或只有一个结点 交换根结点的左右儿子 对该结点的左右子树进行交换 1 /** 2 * Defin ...
                            
                            
                                分类:
其他好文   时间:
2020-04-22 20:07:19   
                                阅读次数:
79
                             
                         
                    
                        
                            
                            
                                    Suppose that all the keys in a binary tree are distinct positive integers. A unique binary tree can be determined by a given pair of postorder and ino ...
                            
                            
                                分类:
其他好文   时间:
2020-04-22 12:51:03   
                                阅读次数:
65
                             
                         
                    
                        
                            
                            
                                    Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. N ...
                            
                            
                                分类:
其他好文   时间:
2020-04-22 10:01:42   
                                阅读次数:
64
                             
                         
                    
                        
                            
                            
                                ? ? 最近免费试用了一下云服务器,然后在两台服务器上安装了Mysql并搭建了主从同步数据库。mysql数据库的安装,大家可以去查看我的另一篇博客文章,下面为大家介绍搭建步骤及原理。 ? ? mysql主节点即master节点在每次对数据库执行操作后会将操作写入到本地的二进制日志(binary lo ...
                            
                            
                                分类:
数据库   时间:
2020-04-22 09:44:27   
                                阅读次数:
506
                             
                         
                    
                        
                            
                            
                                    题目 https://leetcode cn.com/problems/validate binary search tree/ 给定一个二叉树,判断其是否是一个有效的二叉搜索树。 假设一个二叉搜索树具有如下特征: 节点的左子树只包含小于当前节点的数。 节点的右子树只包含大于当前节点的数。 所有左子 ...
                            
                            
                                分类:
编程语言   时间:
2020-04-22 09:39:44   
                                阅读次数:
68
                             
                         
                    
                        
                            
                            
                                    Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree [1,2,2,3,4,4,3] is symmet ...
                            
                            
                                分类:
其他好文   时间:
2020-04-22 09:28:17   
                                阅读次数:
63