Re: [algogeeks] Re: MS question : string compression

2012-05-26 Thread Hassan Monfared
u forgot to do inplace and you have wrong conversion of count On Sat, May 26, 2012 at 11:31 AM, Anchal Gupta anchal92gu...@gmail.comwrote: hey, here is the function that do the compression and store the output in an array op. void str_comp(char *str) { int count=0,j=0,i; char

[algogeeks] Re: MS question : string compression

2012-05-26 Thread Anchal Gupta
yeah i forgot inplace so to do that we simply add count and ch in str input array instead of op. btw whats wrong with count it give me right answer. On May 26, 12:08 pm, Hassan Monfared hmonfa...@gmail.com wrote: u forgot to do inplace and you have wrong conversion of count On Sat, May 26,

Re: [algogeeks] Re: MS question : string compression

2012-05-26 Thread Hassan Monfared
1- try abb On Sat, May 26, 2012 at 12:07 PM, Anchal Gupta anchal92gu...@gmail.comwrote: yeah i forgot inplace so to do that we simply add count and ch in str input array instead of op. btw whats wrong with count it give me right answer. On May 26, 12:08 pm,

Re: [algogeeks] Re: MS question : string compression

2012-05-26 Thread Ashish Goel
http://michael.dipperstein.com/rle/index.html and basic one is http://www.fileformat.info/mirror/egff/ch09_03.htm Best Regards Ashish Goel Think positive and find fuel in failure +919985813081 +919966006652 On Sat, May 26, 2012 at 1:10 PM, Hassan Monfared hmonfa...@gmail.comwrote: 1- try

[algogeeks] Amazon Q: Implement an algorithm to do wild card string matching

2012-05-26 Thread Ashish Goel
Implement an algorithm to do wild card string matching Best Regards Ashish Goel Think positive and find fuel in failure +919985813081 +919966006652 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

[algogeeks] Amazon Q : Design a logWritter for server kind of application

2012-05-26 Thread Ashish Goel
Design a logWritter for server kind of application Best Regards Ashish Goel Think positive and find fuel in failure +919985813081 +919966006652 -- 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] Amazon Q: Implement an algorithm to do wild card string matching

2012-05-26 Thread atul anand
match(*input , *pattern) if(*pat == 0) return true; if('?' == *pat) return match(input+1,pat+1) || match(input,pat+1) if('*' == *pat) return match(input+1,pat) || match(input,pat+1) if(*text == *pat) return

Re: [algogeeks] Amazon Q: Implement an algorithm to do wild card string matching

2012-05-26 Thread atul anand
typo error above resolved :- match(*input , *pattern) if(*pat == 0) return true; if('?' == *pat) return match(input+1,pat+1) || match(input,pat+1) if('*' == *pat) return match(input+1,pat) || match(input,pat+1) if(*input == *pat)

[algogeeks] Re: MS question : string compression

2012-05-26 Thread Navin Gupta
This is called Run-Length-Encoding (RLE) of a string. Its purpose is to save space.So in case of abcdef,I think the output needed is abcdef (1 is implicit). The added benefit is it makes the solution in-place. Approach:- (In-place and Linear Time) Start from the left of string and

Re: [algogeeks] Re: Algorithm page

2012-05-26 Thread Wladimir Tavares
More posts: http://marathoncode.blogspot.com.br/2012/04/list-comprehension-and-generator.html http://marathoncode.blogspot.com.br/2012/04/floating-point-arithmetic-with.html http://marathoncode.blogspot.com.br/2012/05/algoritmos-gulosos.html

[algogeeks] Re: Google Q : all anagrams next to each other

2012-05-26 Thread Gene
This will work in fine, but multiplying primes requires arbitrary precision arithmetic for keys of any significant length. You don't need to compute a hash at all. Just maintain two buffers long enough to hold the longest word and an O(n) sort like counting sort. If you are using Latin (8-bit)