[algogeeks] Re: In place sorting

2010-12-29 Thread juver++
Use inplace merge algorithms along with merge sort. http://www.logiccoder.com/Downloads/krnrd20.pdf -- 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

Re: [algogeeks] Re: In place sorting

2010-12-29 Thread monty 1987
hi , this is not a research kind of problem i expect a simple answer. On Wed, Dec 29, 2010 at 2:33 PM, juver++ avpostni...@gmail.com wrote: Use inplace merge algorithms along with merge sort. http://www.logiccoder.com/Downloads/krnrd20.pdf -- You received this message because you are

[algogeeks] Re: In place sorting

2010-12-29 Thread awesomeandroid
please visit this blog http://code-forum.blogspot.com/2010/12/in-place-merge-sort.html to see a simple and straight solution to this problem.however if first array does not have enough space then also it can be done inplace and still lots of research is going on for this. On Dec 29, 2:25 pm,

Re: [algogeeks] Re: In place sorting

2010-12-29 Thread monty 1987
@vishal thanx On Wed, Dec 29, 2010 at 3:39 PM, vishal raja vishal.ge...@gmail.com wrote: Perform simple merging taking the ends of the list. So You compare the last elements of both the list which ever is larger you copy that at the end of the first array and so on. you got to maintain three

[algogeeks] combinations problem

2010-12-29 Thread rajeev kumar
you are given a string.It may have repeated characters.each character has it's own weight.find combination of characters whose sum value is equal to given value. ex: given string 'abcbacbabcc' weight of each character a-5,b-4,c-6. character combination which gives sum 15 is 'aaa' -- Thank You

[algogeeks] Re: combinations problem

2010-12-29 Thread suhash
Is'nt this just a knapsack problem! On Dec 29, 3:45 pm, rajeev kumar rajeevprasa...@gmail.com wrote: you are given a string.It may have repeated characters.each character has it's own weight.find combination of characters whose sum value is equal to given value. ex: given string

Re: [algogeeks] Re: combinations problem

2010-12-29 Thread rajeev kumar
String gives no of occurrences of each character.no of times you select a character should be less than the no of times it appears in the string. ex: given string 'abcbacbabcc' has 3 a's, 4b's, 4 c's. resulting string should have a less than 3 times,b less than 4 times and c less than 4 times.

Re: [algogeeks] Re: combinations problem

2010-12-29 Thread juver++
It's a knapsack problem with bounds. Solve it using DP - for each state keep number of used characters and preserve to exceed the bounds. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

Re: [algogeeks] Re: combinations problem

2010-12-29 Thread rajeev kumar
@juver++ can you elaborate this sentence 'It's a knapsack problem with bounds. Solve it using DP' or send me any link which has good explanation. On Wed, Dec 29, 2010 at 4:52 PM, vishal raja vishal.ge...@gmail.com wrote: i think we don't need to store the total no. of occurance of any

Re: [algogeeks] Re: combinations problem

2010-12-29 Thread juver++
Yes, it's true. But we should process DP in the following order not to take one element more than once. -- 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

Re: [algogeeks] Re: combinations problem

2010-12-29 Thread vishal raja
@juver, ofcourse , and that's not a big deal. On Wed, Dec 29, 2010 at 5:11 PM, juver++ avpostni...@gmail.com wrote: Yes, it's true. But we should process DP in the following order not to take one element more than once. -- You received this message because you are subscribed to the Google

Re: [algogeeks] Re: combinations problem

2010-12-29 Thread juver++
dp[i][j] - true, if there is a way to have sum j after processing the first i elements, and false otherwise. so transitions wil be: dp[i][j] = dp[i - 1][j] OR dp[i - 1][j - weight[i]], (OR means logical or),first term means that we don't want to use i-th character, second - we use it, so the

Re: [algogeeks] Re: combinations problem

2010-12-29 Thread juver++
It's not a big problem when you use 2D matrix instead of 1D for the DP :) -- 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] Strings search problem

2010-12-29 Thread Davin
Given set of words, find an area of the text where these words are as close to each other as possible. Distance is measured on number of words. e.g. for words [rat”, “jat”, “pat”] and text “rat stop the pat blah blah jat by pat jat tra la la” such area is “cat by mat bat” -- You received this

[algogeeks] sudhir mishra wants to chat

2010-12-29 Thread sudhir mishra
--- sudhir mishra wants to stay in better touch using some of Google's coolest new products. If you already have Gmail or Google Talk, visit: http://mail.google.com/mail/b-62d5befb93-c4270e4073-gZW-XtMwbOw3w3XU9CHGZ6uR5ZQ You'll

Re: [algogeeks] Divide an array into two equal subsets

2010-12-29 Thread vishal raja
But the same solution I've given above can give you the solution for this problem . In the formed table of P[i][j] , you can take another variable attached to it as count[i][j] for how many items we have selected yet. So you gotta find , the max. value of j which has count = 50. count[i][j] =

Re: [algogeeks] Divide an array into two equal subsets

2010-12-29 Thread Ankur Khurana
Thanks everybody for wonderful support and special thanks to Vishal raja. . But i was bit apprehensive about your last solution . . i will test it :) and let you know as well . Thanks . . . . On Thu, Dec 30, 2010 at 11:52 AM, vishal raja vishal.ge...@gmail.com wrote: But the same solution I've