[algogeeks] Re: Longest Common Subsequence

2010-08-18 Thread vinodh kumar
heh could u explain the question with a example..??!!

On Aug 18, 8:47 pm, ♪ ѕяiηivαѕαη ♪ 21.sr...@gmail.com wrote:
 Hi..
  Can anyone here explain me /provide me with an algorithm/source code in C
 which efficiently finds out the *longest common substring in the given
 string??*

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algoge...@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.



[algogeeks] Re: Length of Linked List with Cycle

2006-07-21 Thread Vinodh Kumar
To find the length of the loop:1)You know the node where the two pointers have met.(say NodeX)2)Now make one pointer alone traverse through the loop.(Have a counter which increments for every move)3)It will come back to the same node (NodeX) after making 'length of the loop' jumps
ie the counter gives the length of the loop.To find the node where the loop starts.1)You know the length of the loop.2)position both the pointers to the beginning of the loop.3)move one pointer alone for the length of the loop.(ptr1)
[1]-[2]-[3]-[4]-[5]-[6]-[7]-[8]--[9]--[10] ^ |
  |   v   [13]-[12]-[11] 
Here the length of the loop is 6.First move one pointer ptr1 to the sixth node.Now start the second pointer and move them parallely.The point where they meet if the beginning of the loop.Logic : 
Let k be the portion of the list outside the loop.Total length of the list is n + k ( n is the length of the loop).The two pointers will meet after they have made k moves because , the first pointer (ptr1) would have travelled the length of the list(n initially and k now) , ie it would be coming into the loop from the last element of the list while the pointer ptr2 would just be entering the loop.
Thus you can find the starting of the loop.Hope this helpsVinodh 

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/algogeeks  -~--~~~~--~~--~--~---


[algogeeks] Re: find the most occured (more than N/2 times , where N is the length of the array) element in an array

2006-06-20 Thread Vinodh Kumar
Yes , this will work.Here there are nine elements :So after pairing , you get3,1 3,2 3,4 3,5 3The first four pairs donot yield anything.The last lone element 3 is alone taken which is infact the majority of the the array.
I would also like to eloborate what Karthik had said:From the first array , pair the elements. Now if both elements in the pair are the same choose one and add it to another array . say (B) else drop both
This way you will form another array of size N/2+1 (atmost).Do the same thing recursively to this array and you will get the answer when the array is of size 1.Vinodh

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/algogeeks  -~--~~~~--~~--~--~---


[algogeeks] Re: find the most occured (more than N/2 times , where N is the length of the array) element in an array

2006-06-20 Thread Vinodh Kumar
sorry i forgot to mentionedthat array may or may not have a majority element.
If the array may or may not contain the majority element, then after
the last step(ie once you get the get the array with one element) ,
just iterate thru the original array once counting the number of
occurences of this element.



Then you 'll know whether its the majority element or no such element exists.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/algogeeks  -~--~~~~--~~--~--~---


[algogeeks] Re: E-book needed

2006-03-07 Thread Vinodh Kumar
Hi jatin,
why not send the book to the group
vinodh

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/algogeeks  -~--~~~~--~~--~--~---


[algogeeks] Re: Finding Repeated and Missing Numbers

2006-01-01 Thread Vinodh Kumar

Hi,

I think there is a small modification in the equations :

X= (D2 + D1^2)/(2*D1)

Y= (D2 - D1^2)/(2*D1)

Vinodh