[algogeeks] Strings

2011-07-26 Thread syl
im having problem with learning suffix array i have few doubts can kmp be an alternative to suffix array in every case i tried to read SA from wiki but they didnt explain much... could anyone help me in this...i want to learn how to implement it and where to use it. -- You

Re: [algogeeks] strings

2011-06-22 Thread Nishant Mittal
@Harshal... ur solution is nt correct.it is nt printing the characters in order as given in i/p... i know the solution using auxiliary array and using an extra character array to hold the o/p string but if any1 knows inplace solution then plz rply... On 6/22/11, Harshal hc4...@gmail.com wrote:

[algogeeks] strings

2011-06-21 Thread Sriganesh Krishnan
Input will be a string. We need to o/p a string with the order of characters same as the input but with same characters grouped together. I/P: abcdacde O/P: aabccdde I/P: kapilrajadurga O/P: kpilrrjdug I/P: 1232 O/P: 1223 …….. O(n) time……….. O(1) space…. how can you approach these

Re: [algogeeks] strings

2011-06-21 Thread Harshal
You can make use of an auxiliary array(initialized to 0) to store the count of each char and then print it that many times. char inp[]=abcdaabcdefe; int buff[256]={0}; for(int i=0;istrlen(inp);i++) buff[inp[i]]++; for(int j=0;j256;j++) while(buff[j]--) cout(char)j; On Wed, Jun 22, 2011

Re: [algogeeks] strings

2011-06-21 Thread Harshal
ignore above solution. My bad, did'nt see O(1) space constraint!! On Wed, Jun 22, 2011 at 10:53 AM, Harshal hc4...@gmail.com wrote: You can make use of an auxiliary array(initialized to 0) to store the count of each char and then print it that many times. char inp[]=abcdaabcdefe; int

[algogeeks] strings

2011-05-19 Thread Piyush Sinha
Design an algorithm to find whether a given string is formed by the interleaving of two given strings or not. e.g. s1= aabccabc s2= dbbabc s3= aabdbbccababcc Given s1,s2,s3 design an efficient algorithm to find whether s3 is formed from the interleaving of s1 and s2 -- *Piyush Sinha* *IIIT,

Re: [algogeeks] Strings search problem

2010-12-30 Thread 周翔
Distance is measured on number of words. what is your meaning ? can you explain it? 2010/12/29 Davin dkthar...@googlemail.com 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

[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] Strings

2010-07-19 Thread Anand
Given two text strings A of length n and B of length m, you want to transform A into B with a minimum number of operations of the following types: delete a character from A, insert a character into A, or change some character in A into a new character. The minimal number of such operations