Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

perl: remove elements of array2 from array1

Name: Anonymous 2010-05-14 6:41

Hi, I'm learning perl programming and would appreciate some help. How do I write code to remove elements of array2 from array1

I.e.

@array1={'a','b','c','d'}
@array2={''a','z','c','x'}


(magic happens, processes @array1 and @array2)

dump @array1 gives 'b','d'

Any clues?

Thanks!

Name: Anonymous 2010-05-14 16:34

>>10
Depends on how you implement sets. I'm no computer scientist, but it seems to me that you could get it in O(n) if you used sorted lists for your set implementation.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List