the simplest way is to use a hashmap, or an array arr[10000] and keep track of the number seen so far, eg. by making arr[num]=1, and checking while inserting new elements. second question is a bit unclear
On Wed, Jun 1, 2011 at 10:04 PM, Abhishek Goswami <[email protected]>wrote: > I am sure this question has come already but can anyone point me answer > again. > > 1.if user enter number 0 to 10000. than what will we algorithum to > determine duplicate number (Note : user can not enter more than > 10000 number) > > 2. if we have a number in the range of [1...5] than we insert number > randomly into array. how will we arrange element in sorted order. > > Ex. 1 1 2 4 5 5 5 3 4 > > 1 1 2 3 4 4 5 5 > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- Harshal Choudhary, III Year B.Tech CSE, NIT Surathkal, Karnataka, India. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
