Re: [algogeeks] minimum window containing charecters

2010-08-11 Thread Algoose chase
@ Anand, No , It doesnt Try with String2 = LH String1 = HELLO. I think LCS solves a different problem from the one being asked here. I think we must generate all possible combination of strings and for each combination , check if all chars from str2 is present in it. On Sun, Aug 1, 2010 at

Re: [algogeeks] minimum window containing charecters

2010-08-11 Thread srikanth sg
all the solutions mentioned above are not complete 1)need to solve this problem with sliding window concept 2)its O(n) On Wed, Aug 11, 2010 at 2:43 PM, Algoose chase harishp...@gmail.com wrote: @ Anand, No , It doesnt Try with String2 = LH String1 = HELLO. I think LCS solves a

Re: [algogeeks] minimum window containing charecters

2010-08-11 Thread sharad kumar
@all:u need to calculate the hash value of very substring(no other go since the letters are in different order we ought to do it).then apply Rain Karp algorithm. On Wed, Aug 11, 2010 at 2:43 PM, Algoose chase harishp...@gmail.com wrote: @ Anand, No , It doesnt Try with String2 = LH

Re: [algogeeks] minimum window containing charecters

2010-08-01 Thread Ashish Goel
solution could be to find the charcter position from both sides for each char of s2 then from the 2*n array, find the smallest index from left and largest from right, within these two indexes all chars would be there one case where one of the chars can be missing can be found if a row in this 2-d

Re: [algogeeks] minimum window containing charecters

2010-08-01 Thread Ashim Kapoor
I am not sure, but can I do this using a suffix trie ? any comments ? On Sun, Aug 1, 2010 at 2:29 PM, Ashish Goel ashg...@gmail.com wrote: solution could be to find the charcter position from both sides for each char of s2 then from the 2*n array, find the smallest index from left and

Re: [algogeeks] minimum window containing charecters

2010-08-01 Thread srikanth sg
plz .. if any one knows dp solution then tell ... On Sun, Aug 1, 2010 at 7:31 AM, Ashim Kapoor ashimkap...@gmail.com wrote: I am not sure, but can I do this using a suffix trie ? any comments ? On Sun, Aug 1, 2010 at 2:29 PM, Ashish Goel ashg...@gmail.com wrote: solution could be to find

Re: [algogeeks] minimum window containing charecters

2010-08-01 Thread Anand
Using Dynamic programing(Longest common subsequence logic) we can solve this problem in O(nm) where n is the length of the first string and m is the length of second string. Last element of matrix which the length of the string that matches. http://codepad.org/cyiKEMSF

Re: [algogeeks] minimum window containing charecters

2010-08-01 Thread srikanth sg
dude they dont need to be in the same order .. how are taking care of that On Sun, Aug 1, 2010 at 10:47 AM, Anand anandut2...@gmail.com wrote: Using Dynamic programing(Longest common subsequence logic) we can solve this problem in O(nm) where n is the length of the first string and m is the

Re: [algogeeks] minimum window containing charecters

2010-08-01 Thread Anand
Even if they are not in the same order still it works http://codepad.org/jpCUqwpA http://codepad.org/jpCUqwpA On Sun, Aug 1, 2010 at 10:52 AM, srikanth sg srikanthini...@gmail.comwrote: dude they dont need to be in the same order .. how are taking care of that On Sun, Aug 1, 2010 at 10:47

Re: [algogeeks] minimum window containing charecters

2010-08-01 Thread Nikhil Jindal
wat abt duplicates? eg THAT TT answer should be 1 or 4 ? On Sun, Aug 1, 2010 at 11:22 PM, srikanth sg srikanthini...@gmail.comwrote: dude they dont need to be in the same order .. how are taking care of that On Sun, Aug 1, 2010 at 10:47 AM, Anand anandut2...@gmail.com wrote: Using Dynamic

Re: [algogeeks] minimum window containing charecters

2010-08-01 Thread Anand
answer should be the 2. http://codepad.org/olNm2SoM On Sun, Aug 1, 2010 at 10:56 AM, Nikhil Jindal fundoon...@yahoo.co.inwrote: wat abt duplicates? eg THAT TT answer should be 1 or 4 ? On Sun, Aug 1, 2010 at 11:22 PM, srikanth sg srikanthini...@gmail.comwrote: dude they dont need to be

[algogeeks] minimum window containing charecters

2010-07-31 Thread srikanth sg
given two string , find the minimum width in string 1 containing the all characters of string 2 , they may present in different order string 1-HELLO string 2- LE answer-2 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group,

Re: [algogeeks] minimum window containing charecters

2010-07-31 Thread jalaj jaiswal
@ abv ... ab to band kar de bhai On Sat, Jul 31, 2010 at 7:09 PM, srikanth sg srikanthini...@gmail.comwrote: given two string , find the minimum width in string 1 containing the all characters of string 2 , they may present in different order string 1-HELLO string 2- LE answer-2 -- You

Re: [algogeeks] minimum window containing charecters

2010-07-31 Thread srikanth sg
LOL :P On Sat, Jul 31, 2010 at 8:18 AM, jalaj jaiswal jalaj.jaiswa...@gmail.comwrote: @ abv ... ab to band kar de bhai On Sat, Jul 31, 2010 at 7:09 PM, srikanth sg srikanthini...@gmail.comwrote: given two string , find the minimum width in string 1 containing the all characters of

Re: [algogeeks] minimum window containing charecters

2010-07-31 Thread Nikhil Jindal
At the moment, I can only think of an O(n^3) algo. Maybe if you can find a hash function which computes the hash value depending on the unique characters the string contains, you can reduce it to O(n^2). On Sat, Jul 31, 2010 at 7:09 PM, srikanth sg srikanthini...@gmail.comwrote: given two