View Single Post
  #33  
Old 11-29-2007, 10:54 PM
Kristi Kristi is offline
Bowie's Deciple
Kristi's Avatar
Join Date: Dec 2003
Location: Boston, MA
Posts: 748
Kristi has a spectacular aura aboutKristi has a spectacular aura about
Send a message via AIM to Kristi Send a message via MSN to Kristi
Quote:
Originally Posted by Tolnaftate2004 View Post
Also, the method you proposed for determining the intersection gives duplicates.

PHP Code:
  temp.intersect = new[smallerarray.size()];

  for(
etemp.largerarray)
   
temp.b.("v"@e) = true;

  for(
esmallerarray)
   if(
temp.b.("v"@e)) {
     
temp.intersect[temp.j] = e;
     
temp.b.("v"@e) = false;
     
temp.j++;
   } 
I should also point out that its O(n+m)
__________________

Last edited by Kristi; 11-29-2007 at 11:06 PM..
Reply With Quote