Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Longest Common Subsequence

by Limbic~Region (Chancellor)
on May 16, 2006 at 19:35 UTC ( [id://549873]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    {M => [0, 2], O => [1]}
    
  2. or download this
    my @pos;
    for my $index (0 .. $#str) {
    ...
            push @{$pos[$index]{$char}}, $offset;
        }
    }
    
  3. or download this
    my $sh_str = reduce {length($a) < length($b) ? $a : $b} @str;
    
  4. or download this
    [2, 1, 1]
    
  5. or download this
    [[1], [1, 2], [2]]
    
  6. or download this
    [1, 1, 2]
    [1, 2, 2]
    
  7. or download this
    my (%lookup, @mapping);
    CHAR:    
    ...
            push @mapping, $ref;
        }
    }
    
  8. or download this
    [1, 2, 3] is greater than [0, 0, 1]
    [9, 1, 5] is NOT greater than [3, 2, 1] because 1 < 2
    
  9. or download this
    my %greater;
    
    ...
        # Return which was greater
        return $cmp;
    }
    
  10. or download this
    # A max depth watermark and a path representing that depth
    my ($max, $path) = (0, '');
    ...
    # Work queue
    # 0 => path, 1 => depth, 2 => last visited leaf
    my @work = map [$_, 1, $_], keys %greater;
    
  11. or download this
    while (@work) {
        my $item = pop @work;
    ...
    
        push @work, map ["$route:$_", $cur_depth + 1, $_], @{$greater{$las
    +t_node}[NODE]};
    }
    
  12. or download this
    my $hidden_msg = join '', map $lookup{$_}, split /:/, $path;
    return $hidden_msg;
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://549873]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2024-04-24 19:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found