Morris post order traversal algorithm
兴趣是最好的老师. 多记几个例子, 增加情趣.
举个例子关于中序遍历,

9
/ \
|
5 8
|
/ \ \
|
1 4 7
|
/ \ /
|
2 3 6
就是从最左边开始, 遍历五次,
1,
2,
3, 4, 5
6,
7, 8, 9,
最后结果是 1 2 3 4 5 6 7 8 9
加一个dummy node, with left child is the root node.
|

blogs to read:
http://www.cnblogs.com/AnnieKim/archive/2013/06/15/MorrisTraversal.html
C# implementation:
https://github.com/jianminchen/MorrisOrder/blob/master/MorrisPostOrder.cs
Morris order in order traversal
https://github.com/jianminchen/MorrisInOrderTraverse/blob/master/Program.cs
Morris post order traversal algorithm的更多相关文章
- 37. Binary Tree Zigzag Level Order Traversal && Binary Tree Inorder Traversal
Binary Tree Zigzag Level Order Traversal Given a binary tree, return the zigzag level order traversa ...
- Leetcode, construct binary tree from inorder and post order traversal
Sept. 13, 2015 Spent more than a few hours to work on the leetcode problem, and my favorite blogs ab ...
- [LeetCode] Binary Tree Vertical Order Traversal 二叉树的竖直遍历
Given a binary tree, return the vertical order traversal of its nodes' values. (ie, from top to bott ...
- [LeetCode] Binary Tree Level Order Traversal II 二叉树层序遍历之二
Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left ...
- [LeetCode] Binary Tree Zigzag Level Order Traversal 二叉树的之字形层序遍历
Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to ...
- [LeetCode] Binary Tree Level Order Traversal 二叉树层序遍历
Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, ...
- LeetCode Binary Tree Vertical Order Traversal
原题链接在这里:https://leetcode.com/problems/binary-tree-vertical-order-traversal/ 题目: Given a binary tree, ...
- Binary Tree Zigzag Level Order Traversal [LeetCode]
Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to ...
- [Leetcode][JAVA] Binary Tree Level Order Traversal
Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, ...
随机推荐
- MVC5 网站开发之七 用户功能 3用户资料的修改和删除
这次主要实现管理后台界面用户资料的修改和删除,修改用户资料和角色是经常用到的功能,但删除用户的情况比较少,为了功能的完整性还是坐上了.主要用到两个action "Modify"和& ...
- 了解HTML表单之form元素
前面的话 表单是网页与用户的交互工具,由一个<form>元素作为容器构成,封装其他任何数量的表单控件,还有其他任何<body>元素里可用的标签 表单能够包含<input& ...
- SQL Server-聚焦移除Bookmark Lookup、RID Lookup、Key Lookup提高SQL查询性能(六)
前言 前面几节都是讲的基础内容,本节我们讲讲索引性能优化,当对大数据进行处理时首先想到的就是索引,一旦遇到这样的问题则手忙脚乱,各种查资料,为何平常不扎实基本功呢,我们由浅入深,简短的内容,深入的理解 ...
- Laravel学习--关于Relation的坑
前段时间比较忙,就没有坚持写博客,但发现这周末再想捡起来,好难,一直到了今天晚上,才决定坐下来写一篇,哈哈哈-- 最近在用 Laravel 5.2,踩了几个关于 Relation 的坑,在这里用博客记 ...
- php-resque的设计和使用
php-resque-1.2-annotated 一个 php-resque 源码阅读的项目,欢迎大家star php-resque的设计 在Resque中,一个后台任务被抽象为由三种角色共同完成: ...
- spring aop
什么是AOP AOP(Aspect-OrientedProgramming,面向方面编程),它利用一种称为“横切”的技术,剖解开封装的对象内部,并将那些影响了多个类的公共行为封装到一个可重用模块,并将 ...
- 「译」JUnit 5 系列:基础入门
原文地址:http://blog.codefx.org/libraries/junit-5-basics/ 原文日期:25, Feb, 2016 译文首发:Linesh 的博客:JUnit 5 系列: ...
- IIS 如何设置多个Access-Control-Allow-Origin
1,跨域请求ajax,可以增加请求Header,动态添加 System.Collections.Generic.List<string> lHost = new System.Collec ...
- WPF 自定义ContextMenu且为左键点击显示
<Button Click="Button_Click_3" Style="{StaticResource NormalButtonStyle}"> ...
- ASP.NET MVC——URL路由
在MVC之前,ASP.NET假设请求的URL与服务器上的文件之间有关联,服务器接受请求,并输出相应的文件.而在引入MVC后,请求是由控制器的动作方法来处理的.为了处理URL,便引入了路由系统. 首先我 ...