[algogeeks] Re: getting wrong answer for problem

2007-03-30 Thread Muntasir Azam Khan
Hi, I think you have misread the problem. You are allowed to take away letters from the middle of the input string. So, for ADAM, you have to check AAM (D is removed) ADM (A is removed) in addition to the usual substrings (i.e. strings formed by taking away letters from the beginning or the

[algogeeks] Re: getting wrong answer for problem

2007-03-30 Thread Dhruva Sagar
Are you really sure that your assumption is correct? I am not sure about the fact that you can take sub strings from the word by removing characters from between them... AAM is certainly not valid sub string for this case as far as my understanding of the problem stands. On 3/30/07, Muntasir Azam

[algogeeks] Re: Sum of subsets

2007-03-30 Thread Shalin Shah
We have set named S. We assume we have an algorithm that specifies if there is a subset in S that sum of it's elements equals to K in O(n) and returns TRUE or FALSE. That assumption is either wrong, or you have specified the problem incorrectly. Is subset the right word? Do you mean

[algogeeks] Re: Sum of subsets

2007-03-30 Thread Dhruva Sagar
And we have to find all the elements of the set S using the sum method... hence we don't have the members of the set S. The method hence should more likely be like SUM(K) which returns TRUE or FALSE if there's a subset, sum of whose elements is equal to k. It is a very interesting problem... On

[algogeeks] Re: getting wrong answer for problem

2007-03-30 Thread Dhruva Sagar
Yes, i read the problem again. My interpretation was incorrect. Generally one tends to interpret a problem in a way it's a bit easier to understand :D. That happened with me on this occasion. It's a pretty complex problem from where i see it. and time limit:10 seconds!!! Seems rather too less...

[algogeeks] Re: getting wrong answer for problem

2007-03-30 Thread Dhruva Sagar
Oh I think i wasn't thinking straight... I think the problem can be solved by simply removing 'i' letters from the string and check if that is a palendrome. where i would go from 1 to lenght. But when i 1...will i need to select all possible 2 length strings from the word and remove them one by

[algogeeks] Re: Sum of subsets

2007-03-30 Thread Muntasir Azam Khan
- Original Message - From: Mahdi [EMAIL PROTECTED] To: Algorithm Geeks algogeeks@googlegroups.com Sent: Friday, March 30, 2007 1:27 PM Subject: [algogeeks] Sum of subsets We have set named S. We assume we have an algorithm that specifies if there is a subset in S that sum of it's

[algogeeks] Re: Sum of subsets

2007-03-30 Thread Muntasir Azam Khan
On Mar 30, 10:07 pm, Muntasir Azam Khan [EMAIL PROTECTED] wrote: - Original Message - From: Mahdi [EMAIL PROTECTED] To: Algorithm Geeks algogeeks@googlegroups.com Sent: Friday, March 30, 2007 1:27 PM Subject: [algogeeks] Sum of subsets We have set named S. We assume we have an

[algogeeks] A cycle with minimum length

2007-03-30 Thread Mahdi
Hello everyone! We have n points in a chart that none of them have the same length(I mean their 'x' parameter). We want to find a cycle with MINIMUM length with these assumptions : We start from the point with minimum length, meeting all of the points and finally return to the starting point. We

[algogeeks] Re: Sum of subsets

2007-03-30 Thread Mahdi
OK. that is the assumption of the problem that this is done in O(n). Perhaps it is imaginary. The Question is : assuming this algorithm and using that, now we want to find the exact members that their sum equals to K, with the best order. Thank you. On Mar 30, 7:38 pm, Muntasir Azam Khan [EMAIL

[algogeeks] A graph problem

2007-03-30 Thread Mofid
Hello! We have a graph that is not directional. We want an algorithm to find out if this graph is divided to two parts or not. mofid --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post

[algogeeks] Re: getting wrong answer for problem

2007-03-30 Thread Lego Haryanto
I second that. I believe O(n^2) is a correct call. Consider a function LONGEST_PALINDROME (left, right), where it accepts the substring definition based on left and right, and will return the maximum length of palindrome which can be generated from that substring: LONGEST_PALINDROME (left,

[algogeeks] Re: A graph problem

2007-03-30 Thread Arun
there are existing algorithms to find connected components which wud do it. On 3/30/07, Mofid [EMAIL PROTECTED] wrote: Hello! We have a graph that is not directional. We want an algorithm to find out if this graph is divided to two parts or not. mofid

[algogeeks] Re: A graph problem

2007-03-30 Thread Muntasir Azam Khan
- Original Message - From: Mofid [EMAIL PROTECTED] To: Algorithm Geeks algogeeks@googlegroups.com Sent: Saturday, March 31, 2007 12:28 AM Subject: [algogeeks] A graph problem Hello! We have a graph that is not directional. We want an algorithm to find out if this graph is divided

[algogeeks] Re: A graph problem

2007-03-30 Thread Karthik Singaram L
DFS --~--~-~--~~~---~--~~ 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

[algogeeks] Re: Sum of subsets

2007-03-30 Thread dor
Ok, so you have an oracle that gives you the answer for any SUBSET-SUM (the decision problem) instance in O(n), and you want to use it to actually construct the solution. It's obvious that you can construct the solution in O(n^2) (at most n queries to the oracle). Start with the initial set S.