Daily Archives: October 24, 2012

iterator for BST

  http://www.cornelrat.ro/?p=56   http://www.overclockers.com/forums/showthread.php?t=621509   http://www.overclockers.com/forums/showthread.php?t=621509  

Posted in algorithm | Tagged | Leave a comment

java implementation for bst

http://algs4.cs.princeton.edu/32bst/BST.java.html

Posted in algorithm | Tagged | Leave a comment

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

Posted in interview | Tagged | Leave a comment

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

Posted in interview | Tagged | Leave a comment

re construct tree from in-order and post order

http://codepad.org/8u1D6tAH

Posted in algorithm | Tagged | Leave a comment

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

Posted in Uncategorized | Tagged | Leave a comment

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

Posted in Uncategorized | Tagged | Leave a comment