Re: [algogeeks] Re: character count in array

2011-09-05 Thread bharatkumar bagana
@mohit: that will modify the original array and also time =O(nlogn)... On Mon, Sep 5, 2011 at 1:01 AM, Ankuj Gupta wrote: > @mohit: that will modify the original array > > On Sep 4, 6:40 pm, sarath prasath wrote: > > here is my approach > > where i left the non repeating characters as it is and

Re: [algogeeks] Re: character count in array

2011-09-04 Thread sukran dhawan
@mohit :good one On Sun, Sep 4, 2011 at 4:34 PM, mohit verma wrote: > hey guys > why hashing? > can't we simply sort the array of characters in-place - space complexity > O(1) . > and then simply rearrange the array in-place with character+frequency. > > On Sun, Sep 4, 2011 at 3:13 PM, bharatkum

Re: [algogeeks] Re: character count in array

2011-09-04 Thread mohit verma
hey guys why hashing? can't we simply sort the array of characters in-place - space complexity O(1) . and then simply rearrange the array in-place with character+frequency. On Sun, Sep 4, 2011 at 3:13 PM, bharatkumar bagana < bagana.bharatku...@gmail.com> wrote: > +1 rahul and +1 ankuj > > > On S

Re: [algogeeks] Re: character count in array

2011-09-04 Thread bharatkumar bagana
+1 rahul and +1 ankuj On Sat, Sep 3, 2011 at 11:37 AM, icy` wrote: > Just use a hash to count frequency of something; e.g. in ruby: > ar= %w(a a b c a b b c d e a d e f) > freq=Hash.new(0) > ar.each {|c| freq[c]+=1} > p freq > > #output > #{"a"=>4, "b"=>3, "c"=>2, "d"=>2, "e"=>2, "f"=>1} > > yo

Re: [algogeeks] Re: character count in array

2011-09-03 Thread rajul jain
@ankuj just want to clarify that in hashing method we require array of fixed size let say arr[26] , so is it considered as constant space or not? On Sat, Sep 3, 2011 at 8:02 PM, siddharam suresh wrote: > sol already posted please search old thread > Thank you, > Sid. > > > > On Sat, Sep 3, 2011

Re: [algogeeks] Re: character count in array

2011-09-03 Thread siddharam suresh
sol already posted please search old thread Thank you, Sid. On Sat, Sep 3, 2011 at 8:01 PM, Ankuj Gupta wrote: > If we take our input to be characters a-z ans A-Z then we require > fixed space which can be treated as O(1). > On Sep 3, 7:10 pm, teja bala wrote: > > this 'll work if u i/p the s