View Single Post
  #34  
Old 11-29-2007, 11:08 PM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004
Quote:
Originally Posted by Kristi View Post

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

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

  for(
esmallerarray)
   if(
temp.b.("v"@e)&&!(temp.c.("v"@e))) {
     
temp.intersect[temp.j] = e;
     
temp.c.("v"@e) = true;
     
temp.j++;
   } 
Okay, so why the temp.intersect array now? We can just do:

PHP Code:
  for(esmallerarray)
   if(
temp.b.("v"@e)) 
     
temp.c.("v"@e) = true;

  
temp.intersect temp.c.getdynamicvarnames(); 
I think O(getdynamicvarnames) ~ O(temp.intersect[temp.j++] =), at worst. I suppose the only issue here would be getting the size to optimize the set-making and the eventual substrings. Just some thoughts...
__________________
◕‿‿◕ · pfa · check yer syntax! · src

Killa Be: when i got that locker in 6th grade the only thing in it was a picture of a midget useing a firehose :/
Reply With Quote