Can't we do this using map library function..mapping the integer with their
frequency count??
On Sun, May 15, 2011 at 10:15 PM, Dave dave_and_da...@juno.com wrote:
@Akshata: Yes. In my response of May 7, I proposed an algorithm using
hashing. On May 9, Apoorve asked if there was an in-place
hash all the elements. Keys are stored in hashmap in sorted order based on
values. just iterate thru the hashmap extracting the first k keys.
m I missing something?
On Thu, May 12, 2011 at 2:50 AM, Dave dave_and_da...@juno.com wrote:
@Apoorve: I don't believe that you can determine the
@Dave: Can there be an in-place O(n) solution to this???
On Mon, May 9, 2011 at 7:01 PM, Dave dave_and_da...@juno.com wrote:
@Ashish: By compress, I meant to transfer the active entries in the
hash table into contiguous elements of an array. Since the hash table
itself is probably stored in
On Mon, May 9, 2011 at 11:44 AM, Ashish Goel ashg...@gmail.com wrote:
Dave,
w.r.t statement, After all integers are processed, compress out the unused
hash table
entries and find the Kth largest element,
I could not understand the compress concept...are you saying something on
counting
Dave,
w.r.t statement, After all integers are processed, compress out the unused
hash table
entries and find the Kth largest element,
I could not understand the compress concept...are you saying something on
counting sort philosophy?
say the list is
5
4
4
3
3
3
2
2
2
2
1
1
1
1
1
so the hash
ok, i got it.. ya i misunderstood it..
On Sat, May 7, 2011 at 11:03 PM, Dave dave_and_da...@juno.com wrote:
@Gaurav: As I understand your solution, you are finding the K largest
integers based on value, rather than the K with the highest frequency
of occurrence.
@Amit: Hash the integers