
Recent Posts
Archives
calendar
Categories
Meta
Tag Cloud
Daily Archives: October 24, 2012
iterator for BST
checking if an array is a post order of BST
recursive : boolean isPostOrder( int a[], int length ){ int root = a[length – 1]; if( length <= 1 ) { return true; } int i, j; for( i = 0; i < length 1 && a[i] < root; i++ … Continue reading
Boggle puzzle
for an M*N matrix, each element is a char, you can link the char with another char which is above, below, left, right of it, no diagonal , find how many words it would returned which is in the dictionary. … Continue reading
cracking code 5.5
// write a function to determin the number of bit required to convert a>b // a = 31 111111 , b = 14 1110, a>b 11111> 1110 // step 1 11111> 01111 // step 2 0111 > 01110 // convert … Continue reading
cracking code 4.8
// find a path in the tree, sum up to a value, the path is not necessary start at root void findPath( TreeNode root, int sum, ArrayList arr, int level ) { // base case check if( root == null … Continue reading