For the quantum solution, just sort the array.use warnings; use strict; my @a2 = qw/1 2 2 3 3 3 4 4 4 4 5 6 7/;#list of to_visit my @a1 = qw/1 2 3 4/;#list of visited my %visited; @visited{ @a1 } = 1; @a2 = grep {not exists $visited{ $_ }} @a2; print "list of to visit\n"; print_arrays(\@a2); print "\nlist visited\n"; print_arrays(\@a1); sub print_arrays { my $x = shift; for my $item1 ( @$x ) { print $item1,"\n"; } print "\n"; }
-Mark
In reply to Re: Quantum::Superpositions prob
by kvale
in thread Quantum::Superpositions prob
by tommycahir
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |