[algogeeks] Dutch National Flag Algorithm

2013-01-15 Thread Ankit Tripathi
Hello everyone, Recently I encountered following program : Given an integer array of n elements ( where n is a multiple of 3 ), example : *a1, a2, a3, a4, b1, b2, b3, b4, c1, c2, c3, c4*. You have to rearrange the array in such a manner that the elements of array becomes : *a1, b1, c1, a2, b2, c2,

[algogeeks] Re: Resources for understanding Dynamic programming

2012-11-17 Thread Ankit Tripathi
One of the best material related to algorithms as well as dynamic programming is the lecture notes by Jeff Erickson sir, you can check it out in the following link : http://www.cs.uiuc.edu/~jeffe/teaching/algorithms/ --

Re: [algogeeks] Check if a binary tree is Binary Search Tree or not.

2012-11-06 Thread Ankit Tripathi
I totally agree with atul007. And that's optimal because one must check every node for checking whether the tree is a BST or not, and this algorithm visits each node exactly once. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To view this

[algogeeks] Re: Informatica written que : C output

2012-10-31 Thread Ankit Tripathi
I would also like to add up something related to this context. One can use *fprintf* and set the *1st argument to 2*, *which stands for stderr*, ie., the standard error stream. stderr is defined in *stdio.h* header. The classic thing about stderr is that, by default it does not buffers any conten

[algogeeks] Re: Complicated declaration C

2012-10-30 Thread Ankit Tripathi
Your interpretation is right, i.e., the second argument returns an int. -- 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/-/6iB_TkYbdUYJ. To post to this group,

[algogeeks] Re: C Macro

2012-10-30 Thread Ankit Tripathi
Besides i prefer to write the following #define which is generic and works in all case, i.e., it doesn't matter whether you pass pointers, float, int, etc; *#define swap( a, b )size_t t; t = a; a = b; b = t;* 1 more thing now you don't have to pass any other information i.e., whether your