Showing posts with label Algorithm. Show all posts
Showing posts with label Algorithm. Show all posts
Saturday, June 13, 2015
Uniform Iterative&Recursive solutions for tree traversal in in/pre/post order
https://github.com/tianlixu/leetcode/blob/master/94-binary-tree-inorder-traversal.cpp
https://github.com/tianlixu/leetcode/blob/master/145-binary-tree-preorder-traversal.cpp
https://github.com/tianlixu/leetcode/blob/master/146-binary-tree-postorder-traversal.cpp
Wednesday, May 20, 2015
Binary Tree Tranversal
Inorder Traversal : LVR
Preorder Traversal: VLR
Postorder Traversal: LRV
depends on the position of V.
Level Traversal: BFS
Preorder Traversal: VLR
Postorder Traversal: LRV
depends on the position of V.
Level Traversal: BFS
Monday, December 29, 2014
Wednesday, December 24, 2014
Find the Median - To be continued
The median is the "middle number" in a sorted list of numbers. If it's odd, then it is the middle value. If it's even, it's the average of the two middle values.
/* Problem:
* How to find the median of a sorted array?
* How to find the median of an unsorted array?
* How to find the median of an unsorted array without sorting?
*
* How to find the median of two sorted array? - from LeetCode
* How to find the median of given N sorted arrays?
*/
Reference:
http://en.wikipedia.org/wiki/Median_of_medians
/* Problem:
* How to find the median of a sorted array?
* How to find the median of an unsorted array?
* How to find the median of an unsorted array without sorting?
*
* How to find the median of two sorted array? - from LeetCode
* How to find the median of given N sorted arrays?
*/
Reference:
http://en.wikipedia.org/wiki/Median_of_medians
Subscribe to:
Posts (Atom)