Hash and find duplicate is not O(n) space if O(n) in time. For hashing solution to work in O(n) time, you need O(L) space where L is the size of the largest integer in the array.
On Sun, Jan 16, 2011 at 1:05 AM, Nikhil Agarwal <nikhil.bhoja...@gmail.com>wrote: > So we have either time O(n) and space O(n) [hash and find if duplicate] > & O(nlogn) time & O(1) space [sort and > check]. > > I cannot give any XOR solution. > > > On Sun, Jan 16, 2011 at 10:58 AM, nphard nphard > <nphard.nph...@gmail.com>wrote: > >> No. >> >> >> On Sat, Jan 15, 2011 at 11:06 PM, Nikhil Agarwal < >> nikhil.bhoja...@gmail.com> wrote: >> >>> do you have the range of elements in the array? >>> >>> On Sun, Jan 16, 2011 at 8:51 AM, nphard nphard >>> <nphard.nph...@gmail.com>wrote: >>> >>>> Given an array of integers of size 'n' - consisting of 'n-2' unique >>>> integers and 1 integer with a duplicate, find the repeated element in O(n). >>>> >>>> Note: This is a converse of finding the unique element in an array >>>> consisting of duplicates - which can be solved with the XOR technique - but >>>> I am not sure if the same/similar technique can be applied here. >>>> >>>> -- >>>> 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<algogeeks%2bunsubscr...@googlegroups.com> >>>> . >>>> For more options, visit this group at >>>> http://groups.google.com/group/algogeeks?hl=en. >>>> >>> >>> >>> >>> -- >>> Thanks & Regards >>> Nikhil Agarwal >>> Senior Undergraduate >>> Computer Science & Engineering, >>> National Institute Of Technology, Durgapur,India >>> http://tech-nikk.blogspot.com >>> http://beta.freshersworld.com/communities/nitd >>> >>> >>> -- >>> 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<algogeeks%2bunsubscr...@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<algogeeks%2bunsubscr...@googlegroups.com> >> . >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > > > > -- > Thanks & Regards > Nikhil Agarwal > Senior Undergraduate > Computer Science & Engineering, > National Institute Of Technology, Durgapur,India > http://tech-nikk.blogspot.com > http://beta.freshersworld.com/communities/nitd > > > -- > 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<algogeeks%2bunsubscr...@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.