码迷,mamicode.com
首页 >  
搜索关键字:binary trees    ( 12390个结果)
36. Construct Binary Tree from Inorder and Postorder Traversal && Construct Binary Tree from Preorder and Inorder Traversal
思想: 迭代。 说明: 这类问题,要求一个提供根节点,然后另一个序列(中序序列)可依据根节点分出左右子树。
分类:其他好文   时间:2014-08-27 20:20:38    阅读次数:198
37. Binary Tree Zigzag Level Order Traversal && Binary Tree Inorder Traversal
思路: 使用两个队列(一个可以顺序读,所以用vector模拟),每个队列放一层结点。 题解: 两种方法: 1. 使用栈: O(n) Time, O(n) Space。 2. Morris traversal (构造线索树), O(n) Time, O(1) Space.
分类:其他好文   时间:2014-08-27 20:16:18    阅读次数:227
35. Binary Tree Level Order Traversal && Binary Tree Level Order Traversal II
思想: 若递归,传入层号。若迭代,使用队列,在每层结束时,加入一个标记。 思想: 目前用两种方法:1 同上,最后将结果反转一下。 2.先求出最大层数,再层序遍历。(也许还有更好的方法)
分类:其他好文   时间:2014-08-27 20:16:08    阅读次数:212
34. Convert Sorted List to Binary Search Tree && Convert Sorted Array to Binary Search Tree
思想: 以中间点为根节点,按先序顺序来创建 。
分类:其他好文   时间:2014-08-27 18:33:28    阅读次数:248
33. Minimum Depth of Binary Tree && Balanced Binary Tree
思想:先序遍历。注意的是: 当只有一个孩子结点时,深度是此孩子结点深度加 1 . 思想: 先序遍历。既要返回左右子树判断的结果,又要返回左右子树的深度进行再判断。 所以要么返回一个 pair, 要么函数参数增加一个引用来传递返回值。
分类:其他好文   时间:2014-08-27 18:25:08    阅读次数:207
31. Flatten Binary Tree to Linked List
思想: 如 Hints.
分类:其他好文   时间:2014-08-27 17:53:08    阅读次数:152
信号量的分类
信号量的分类Mutual Exclusion Semaphores(互斥):一种特殊的二进制信号量,专门针对互斥操作进行了优化。Binary Semaphores(二进制):完成互斥、同步操作的最佳方式;速度最快,最常用。Counting Semaphores(计数):类似于二进制信号量,可记录信号...
分类:其他好文   时间:2014-08-27 16:10:07    阅读次数:199
ActiveMQ中使用mysql做持久化报错:Cannot execute statement: impossible to write to binary log since BINLOG_FORM
ActiveMQ中如果使用mysql innodb的同时,开启了binlog,那么在ack消息的时候,日志里就可会报错:java.sql.SQLException: Cannot execute statement: binlogging impossible since BINLOG_FORMAT = STATEMENT and at least one table uses a storage...
分类:数据库   时间:2014-08-27 14:50:47    阅读次数:2492
leetcode之Gray Code
Gray Code The gray code is a binary numeral system where two successive values differ in only one bit. Given a non-negative integer n representing the total number of bits in the cod...
分类:其他好文   时间:2014-08-27 14:45:48    阅读次数:236
26. Binary Tree Maximum Path Sum
思想: 后序遍历。注意路径的连通: 结点不为空时要返回 max( max(leftV, rightV)+rootV, rootV);
分类:其他好文   时间:2014-08-27 14:21:47    阅读次数:148
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!