Re: [algogeeks] Doubt in removing loop from linked list

2012-03-10 Thread Moheed Moheed Ahmad
@Rahul: As Dev said: Now start the fast pointer at the head and take m single steps with both pointers. The fast pointer is at the beginning of the cycle, and the slow pointer has traversed the cycle (2*t - u) times and is back at the beginning of the cycle. k= (2*t-u)p -m When fast pointer is

Re: [algogeeks] A strange doubt with cpp class. Why compile error ?

2012-03-10 Thread Moheed Moheed Ahmad
Isn't Abc() a constructor which means to construct the object. No need for new.. -Cheers Moheed I am who I am, no matter where I am or who I am with. * * On Fri, Mar 9, 2012 at 9:16 PM, atul anand atul.87fri...@gmail.com wrote: may u r confused with java Abc a ; // this itself is

Re: [algogeeks] Maximum height/depth of tree

2012-03-10 Thread Moheed Moheed Ahmad
should be 2. -Cheers, Moheed I am who I am, no matter where I am or who I am with. * * On Sun, Mar 11, 2012 at 11:04 AM, rahul sharma rahul23111...@gmail.comwrote: http://www.geeksforgeeks.org/archives/646 Plz tell that the link i have given in this mail for tree height...isn't the tree

Re: [algogeeks] [Combinatorics] count possible number of binary search trees, given number of nodes

2012-02-11 Thread Moheed Moheed Ahmad
, Moheed Moheed Ahmad mohe...@gmail.com wrote: I know how to solve it programatically, can anybody pls help me to solve it using combinatorics. -Moheed -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email

Re: [algogeeks] Practical way to check the primality in efficent time

2012-02-11 Thread Moheed Moheed Ahmad
There are deterministic polyomial-time algorithm. [AKS-primality] Miller-Robin primality test is a non-deterministic primality test with almost zero chance of error. [All above based on some modification/improvement on fermat's theorem] GNU Multi Precission library can be used to handle large

[algogeeks] [Combinatorics] count possible number of binary search trees, given number of nodes

2012-01-29 Thread Moheed Moheed Ahmad
I know how to solve it programatically, can anybody pls help me to solve it using combinatorics. -Moheed -- 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

Re: [algogeeks] Quick Sort

2012-01-29 Thread Moheed Moheed Ahmad
A typical implementation of quick sort works on quick sorting subarray and comparison is done in a linear manner that is a[i] is compared with pivot and then a[i+1] and so on. Virtual memory systems employ some sort of caching. Caching works on the principle of spatial locality of reference. That

Re: [algogeeks] LINKED LIST

2011-12-26 Thread Moheed Moheed Ahmad
http://cslibrary.stanford.edu/105/LinkedListProblems.pdf -Moheed On Sun, Dec 25, 2011 at 11:39 PM, atul anand atul.87fri...@gmail.comwrote: @ashish : please provide link for that page On Sun, Dec 25, 2011 at 10:36 PM, Ashish Goel ashg...@gmail.com wrote: refer stanford page 1,2,3,4,5,6

Re: [algogeeks] Re: Nice question

2011-12-13 Thread Moheed Moheed Ahmad
To get a abs difference of 0 there are 10 ways similarly getting abs difference of 1 there are 9x2 ways(w1) for 2 its 8x2 (say w(2) for 3 its 7x2 . for 9 its 1x2(w9) let w(i) represents the number of ways to get abs diff of i. So total numbers that are possible from the given abs diff i j k

Re: [algogeeks] Re: Nice question

2011-12-13 Thread Moheed Moheed Ahmad
to the end of his life.' On Wed, Dec 14, 2011 at 12:17 AM, Don dondod...@gmail.com wrote: Moheed, If n=3 and absdiff = {0,0}, your program says that there are 100 possible numbers. Can you show me at least 10 of them? Don On Dec 13, 12:24 pm, Moheed Moheed Ahmad mohe...@gmail.com wrote: To get