thats the challenge man ! if u are declaring a static Array of 2GB and u might find the repeated element in second step then memory is waste ! Thats why hashing ! hashing has complexity of O(n) only ! Instead you can simply use a BBST but complexity is O(n lgn)
On Fri, Jul 15, 2011 at 7:11 PM, Anand Shastri <anand.shastr...@gmail.com> wrote: > File has 4,300,000,000 integers if you hash it will create a distinct hash > for 4,300,000,000 integers. > > On Fri, Jul 15, 2011 at 7:09 PM, radha krishnan > <radhakrishnance...@gmail.com> wrote: >> >> if number is (1<<31) -1 u declare a 2GB array ? >> >> On Fri, Jul 15, 2011 at 6:59 PM, Anand Shastri >> <anand.shastr...@gmail.com> wrote: >> > file any way contains integers why do we need hash those integers? why >> > not >> > use the same integers to index an array. >> > >> > On Fri, Jul 15, 2011 at 6:36 PM, radha krishnan >> > <radhakrishnance...@gmail.com> wrote: >> >> >> >> just hash it >> >> >> >> On Fri, Jul 15, 2011 at 6:28 PM, Anand Shastri >> >> <anand.shastr...@gmail.com> wrote: >> >> > Given a file containing 4,300,000,000 integers, how >> >> > can you find one that appears at least twice >> >> > >> >> > -- >> >> > You received this message because you are subscribed to the Google >> >> > Groups >> >> > "Algorithm Geeks" group. >> >> > To post to this group, send email to algogeeks@googlegroups.com. >> >> > To unsubscribe from this group, send email to >> >> > algogeeks+unsubscr...@googlegroups.com. >> >> > For more options, visit this group at >> >> > http://groups.google.com/group/algogeeks?hl=en. >> >> > >> >> >> >> -- >> >> You received this message because you are subscribed to the Google >> >> Groups >> >> "Algorithm Geeks" group. >> >> To post to this group, send email to algogeeks@googlegroups.com. >> >> To unsubscribe from this group, send email to >> >> algogeeks+unsubscr...@googlegroups.com. >> >> For more options, visit this group at >> >> http://groups.google.com/group/algogeeks?hl=en. >> >> >> > >> > -- >> > You received this message because you are subscribed to the Google >> > Groups >> > "Algorithm Geeks" group. >> > To post to this group, send email to algogeeks@googlegroups.com. >> > To unsubscribe from this group, send email to >> > algogeeks+unsubscr...@googlegroups.com. >> > For more options, visit this group at >> > http://groups.google.com/group/algogeeks?hl=en. >> > >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to algogeeks@googlegroups.com. >> To unsubscribe from this group, send email to >> algogeeks+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.