Tuesday, May 29, 2018

Leetcode 94: Binary Tree Inorder Traversal

May 29, 2018

Introduction


I could not believe that I finally can write working solution using recursive solution today. It is quick and fast. I still remembered that I did choose to write a recursive solution, instead I wrote an iterative solution with some bugs on important meeting. This past 12 months I definitely have done some good training. I CAN write a recursive function very easily on binary tree.

I like to submit as many algorithms as possible on Leetcode.com.

Recursive solution


Here is my recursive solution.

Iterative solution


I like to go over the algorithm with tag stack. I wrote an iterative solution using stack, and it is good workout for me to master stack algorithm one more time.




No comments:

Post a Comment