[algogeeks] Print longest string duplicated M times

2012-05-14 Thread Ashish Goel
I am unclear about the answer provided by Programming Pearls on the question. What this does is to find longest string whose beginning is separated by exactly M chars. The original question is to find the longest string duplicated M times. Any ideas on the approach for this? I could think of havin

Re: [algogeeks] Find Power(N,N),

2012-05-14 Thread atul anand
well if it exceeding the range of the data type , it cannot store it. do you want pow(n,n) to calucate some expression like pow(n,n) % x or pow(n,n) / x ??? or its just posw(n,n) which is required. On Tue, May 15, 2012 at 8:28 AM, pankaj joshi wrote: > Hi All, > > I have written a program to fin

Re: [algogeeks] Find Power(N,N),

2012-05-14 Thread atul anand
just a thought , if you want to calculate specifically power(n,n) then it can be done simply by bit-wise operation power(n,n) a=ceil(n/2); return a << n; On Tue, May 15, 2012 at 8:28 AM, pankaj joshi wrote: > Hi All, > > I have written a program to find out n^n(n power n), > > long long

[algogeeks] initialization problem

2012-05-14 Thread Ashish Goel
I am a bit unclear about the solution on how it is reducing initialization time, can someone help? The only + i get is we are not initializing all elements together but only when the element is accessed. This is addition of two checks from[i]http://groups.google.com/group/algogeeks?hl=en.

[algogeeks] Re: finding anagrams in a list of words

2012-05-14 Thread Gene
Yes exactly. And now I hope to convince you that it's good to learn a few languages so you can use the best one for the problem at hand. In Perl for example, your proposed algorithm looks like this: while (<>) { chomp; push @{ $map{join('', sort split('', $_))} }, $_; } while ( (undef, $val)

[algogeeks] Re: finding anagrams in a list of words

2012-05-14 Thread Gene
Ah but this isn't a key because ac would have the same ascii sum as bb. On May 14, 1:11 pm, payal gupta wrote: > @atul > instead of sorting the string individually which would require tc- O(nlogn) > shouldnot it be a better idea to use the sum of the ascii values of the > individual alphabets a

Re: [algogeeks] Re: finding anagrams in a list of words

2012-05-14 Thread payal gupta
hmm... thnx for the catch of my flaw... On Mon, May 14, 2012 at 11:56 PM, saurabh singh wrote: > u mean ad == bc ? > > > On Mon, May 14, 2012 at 10:41 PM, payal gupta wrote: > >> @atul >> instead of sorting the string individually which would require tc- >> O(nlogn) shouldnot it be a better idea

Re: [algogeeks] Re: finding anagrams in a list of words

2012-05-14 Thread saurabh singh
u mean ad == bc ? On Mon, May 14, 2012 at 10:41 PM, payal gupta wrote: > @atul > instead of sorting the string individually which would require tc- > O(nlogn) shouldnot it be a better idea to use the sum of the ascii values > of the individual alphabets as the key which would require tc-O(n) ???

Re: [algogeeks] new social network (be the owner of the website)

2012-05-14 Thread abhi mehrotra
Dude dont be so futuristic join it if u think it may be useful later. i didnt join it to be a millionaire (i liked the idea and want to go with it thats all). Also read the link http://thetechmag.net/zurker-a-new-and-unique-social-network/ abhhishek On Mon, May 14, 2012 at 7:47 PM, Nikhil Mis

Re: [algogeeks] Re: finding anagrams in a list of words

2012-05-14 Thread payal gupta
@atul instead of sorting the string individually which would require tc- O(nlogn) shouldnot it be a better idea to use the sum of the ascii values of the individual alphabets as the key which would require tc-O(n) ??? On Sun, May 13, 2012 at 7:07 PM, GAURAV CHAWLA wrote: > @deepikaanand: > > > 1

Re: [algogeeks] new social network (be the owner of the website)

2012-05-14 Thread Nikhil Mishra
Company ain't listed yet. Even it gets, think about Offshore funds :-) -Nikhil On Mon, May 14, 2012 at 7:20 PM, abhi mehrotra < abhishekmehrotra.i...@gmail.com> wrote: > Not at all a spam dude just try googling "zurker" and read about it. > > regards > Abhishek > > > > On Mon, May 14, 2012

Re: [algogeeks] new social network (be the owner of the website)

2012-05-14 Thread Nikhil Mishra
Definitely a spam ! :-) . Add + 1... On Mon, May 14, 2012 at 8:39 AM, abhi mehrotra < abhishekmehrotra.i...@gmail.com> wrote: > nope its real social network!! > > > On Sun, May 13, 2012 at 11:14 PM, Rahul wrote: > >> spam >> >> On 5/13/12, abhi mehrotra wrote: >> > Guys, >> > >> > As u all know