1. check here <http://ideone.com/VjjqN> *int isBSTiterative(Tnode *root) {* * int prev = -99999;* * Tnode *node = NULL;* * while (root) {* * push(root);* * if (root->left == NULL) {* * * * do {* * node = pop();* * if (node->data < prev)* * return 0;* * prev = node->data;* * root = node->right;* * } while (root == NULL && isempty() != 1);* * } else {* * root = root->left;* * }* * }* * return 1;* *}*
2.Check here <http://ideone.com/yufa2> *Tnode *BTMirrorIterative(Tnode *root) {* * Tnode *node = NULL, *tmp = NULL;* * * * if (root == NULL)* * return root;* * while (root) {* * push(root);* * if (root->left != NULL)* * root = root->left;* * else if (root->right != NULL)* * root = root->right;* * else {* * do {* * node = pop();* * tmp = node->left;* * node->left = node->right;* * node->right = tmp;* * * * if (head == NULL)* * return root;* * root = head->data;* * } while (root->right == node || root->right == NULL);* * if (root->right != NULL)* * root = root->right;* * }* * }* * return NULL;* *}* Thanks & Regards Anantha Krishnan On Thu, Jun 30, 2011 at 2:12 PM, vikas <mehta...@gmail.com> wrote: > for 1 i did implement exactly the same algorithms. > > and for 2 i donot know why but at that time i was not able to implement it > iteratively and hense implemented its recursive version only. > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/algogeeks/-/hJswdQGammMJ. > > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.