hi
i have a problem,,look at below example
[CODE]
1 390
1 382
1 383
1 357
1 1
1 1
1 376
3 24
we need code that says the number that is repeated more than others in left side is 1 that repeated 7 time and minimum number is 3 that repeated 1 time..and in right side 1 is repeated 2 time,then its most repeated and one of other that is repeated one time (doesn’t matter which one) like 24 that repeated one time is 1 time, then its in minimum place of right numbers…
so i have code for this that exist in below
[code=php]
<?php
$time_start = microtime(true);
ini_set(‘max_execution_time’, 700);
echo “<br>” ;
ini_set(‘memory_limit’, ‘2048M’);
$sumpage1=array();
$sumpage2=array();
$avgin;
$avgout;
$t1=0;
$t2=0;
$file = fopen( “yes.txt”, “r” ) or exit ( “Unable to open file!” ) ;
$str = fgets($file);
while ( !feof ( $file ) )
{
$str = fgets($file);
$r= explode(” “, $str);
/* $r[1]=trim($r[1]);
*/
if(empty($sumpage1[$r[0]])){
$sumpage1[$r[0]]=1;
}
else {
$sumpage1[$r[0]]++;
}
if(empty($sumpage1[$r[1]])){
$sumpage2[$r[1]]=1;
echo $r[1];
echo “<br>”;
}
else {
$sumpage2[$r[1]]++;
echo “dd”.$r[1];
echo “<br>”;
}
}
echo $sumpage2[4];
echo “<center>”;
echo “<br>”;
$x1=max($sumpage1);
$x2=array_search($x1,$sumpage1);
echo “mux number in right: “.$x2.” and this number repeated “.$x1.”times”;
echo “<br>”;
$x11=min($sumpage1);
$x22=array_search($x11,$sumpage1);
echo “min number in right: : “.$x22.” and this number repeated “.$x11.”times”;
echo “<br><br><br>”;
$y1=max($sumpage2);
$y2=array_search($y1,$sumpage2);
echo “mux number in left: “.$y2.” and this number repeated”.$y1.”times”;
echo “<br>”;
$y11=min($sumpage2);
$y22=array_search($y11,$sumpage2);
echo “min number in left: “.$y22.”and this number repeated “.$y11.”times”;
echo “<br>”;
$time_end = microtime(true);
$time = $time_end – $time_start;
echo “proccess time: {$time}”;
echo “</center>”;
?>
whats your point?
this code in big files,cant calculate the minimum right,,,some thing is wrong but…