In case if A contains more than 10,000 integers or so, a multiway search tree can be used which'll reduce the number of nodes to a great extent and searching will also reduce to lesser heights.
On Sat, Jul 3, 2010 at 6:19 PM, jalaj jaiswal <[email protected]>wrote: > we can make a bst of numbers in set a.. then keep increasing count(include > in bst structure) from set b only if already present > finally do a traversal and output those numbers with count equal to 2 > > > On Sat, Jul 3, 2010 at 11:50 AM, divya <[email protected]> wrote: > >> If you are given a set of 1000 integers in a set A , and 10,000,000 >> integers in a set B, how would you create a set C that would only >> contain numbers that are both in A and B? >> >> i have thought of using Hash. >> is there any other efficient method? >> >> -- >> 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]<algogeeks%[email protected]> >> . >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> >> > > > -- > With Regards, > Jalaj Jaiswal > +919026283397 > B.TECH IT > IIIT ALLAHABAD > > -- > 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]<algogeeks%[email protected]> > . > 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 [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.
