php°æ ¿ìËÙÅÅÐò
<?php
$n = array('13','14','55','10','54','2','79','106','89','90','22','60','111','77777','-110','-10','123');
function partition($n,$left,$right)
{
global $n;
$pivot = $n[$left];
$lo=$left;
$hi=$right+1;
while($lo+1!=$hi) {
if($n[$lo+1]<$pivot)
$lo++;
else if($n[$hi-1]>$pivot)
$hi--;
else{
$t=$n[$lo+1];
$n[$lo+1]=$n[$hi-1];
$n[$hi-1]=$t;
$lo++;
$hi--;
}
}
$n[$left]=$n[$lo];
$n[$lo]=$pivot;
return $lo;
}
function quicksort($n,$left,$right)
{
global $n;
$dp = 0;
if ($left<$right) {
$dp=partition($n,$left,$right);
quicksort($n,$left,$dp-1);
quicksort($n,$dp+1,$right);
}
}
quicksort($n,0,sizeof($n)-1);
print_r($n);
?>
¿ìËÙÅÅÐòÊǶÔðÅÝÅÅÐòµÄÒ»ÖָĽø¡£ËüµÄ»ù±¾Ë¼ÏëÊÇ£ºÍ¨¹ýÒ»ÌÉÅÅÐò½«ÒªÅÅÐòµÄÊý¾Ý·Ö¸î³É¶ÀÁ¢µÄÁ½²¿·Ö£¬ÆäÖÐÒ»²¿·ÖµÄËùÓÐÊý¾Ý¶¼±ÈÁíÍâÒ»²»²¿·ÖµÄËùÓÐÊý¾Ý¶¼ÒªÐ¡£¬È»ºóÔÙ°´´Î·½·¨¶ÔÕâÁ½²¿·ÖÊý¾Ý·Ö±ð½øÐпìËÙÅÅÐò£¬Õû¸öÅÅÐò¹ý³Ì¿ÉÒԵݹé½øÐУ¬ÒÔ´Ë´ïµ½Õû¸öÊý¾Ý±ä³ÉÓÐÐòÐòÁС£
¼ÙÉèÒªÅÅÐòµÄÊý×éÊÇA[1]……A[N]£¬Ê×ÏÈÈÎÒâÑ¡È¡Ò»¸öÊý¾Ý£¨Í¨³£Ñ¡ÓõÚÒ»¸öÊý¾Ý£©×÷Ϊ¹Ø¼üÊý¾Ý£¬È»ºó½«ËùÓбÈËüСµÄÊý¶¼·Åµ½ËüÇ°Ã棬ËùÓбÈËü´óµÄÊý¶¼·Åµ½ËüºóÃ棬Õâ¸ö¹ý³Ì³ÆΪһÌÉ¿ìËÙÅÅÐò¡£Ò»ÌÉ¿ìËÙÅÅÐòµÄËã·¨ÊÇ£º
1£©¡¢ÉèÖÃÁ½¸ö±äÁ¿I¡¢J£¬ÅÅÐò¿ªÊ¼µÄʱºòI£º=1£¬J£º=N£»
2£©ÒÔµÚÒ»¸öÊý×éÔªËØ×÷Ϊ¹Ø¼üÊý¾Ý£¬¸³Öµ¸øX£¬¼´X£º=A[1]£»
3£©¡¢´ÓJ¿ªÊ¼ÏòÇ°ËÑË÷£¬¼´Óɺó¿ªÊ¼ÏòÇ°ËÑË÷£¨J£º=J-1£©£¬ÕÒµ½µÚÒ»¸öСÓÚXµÄÖµ£¬Á½Õß½»»»£»
4£©¡¢´ÓI¿ªÊ¼ÏòºóËÑË÷£¬¼´ÓÉÇ°¿ªÊ¼ÏòºóËÑË÷£¨I£º=I+1£©£¬ÕÒµ½µÚÒ»¸ö´óÓÚXµÄÖµ£¬Á½Õß½»»»£»
5£©¡¢Öظ´µÚ3¡¢4²½£¬Ö±µ½I=J£»
¿ìËÙÅÅÐò¾ÍÊǵݹéµ÷Óô˹ý³Ì——ÔÚÒÔ49ΪÖеã·Ö¸îÕâ¸öÊý¾ÝÐòÁУ¬·Ö±ð¶ÔÇ°ÃæÒ»²¿·ÖºÍºóÃæÒ»²¿·Ö½øÐÐÀàËƵĿìËÙÅÅÐò£¬´Ó¶øÍê³ÉÈ«²¿Êý¾ÝÐòÁеĿìËÙÅÅÐò£¬×îºó°Ñ´ËÊý¾ÝÐòÁбä³ÉÒ»¸öÓÐÐòµÄÐòÁÐ
²Î¿¼ÍøÒ³£ºhttp://blog.csdn.net/sws9999/archive/2008/08/18/2791812.aspx
Ïà¹ØÎĵµ£º
//±éÀúĿ¼¼°Îļþ
function get_all_files( $path )
{
$list = array();
foreach( glob( $path . '/*') as $item )
{
& ......
ÍøÉÏÕÒµ½µÄ£º¹²ÏíÒ»ÏÂ
<?
//¡¾¾¯¸æ¡¿:δ¾Ðí¿ÉÇëÎðËæ±ãÐÞ¸Ä
//-----------------------------------------------------------------------------------
-------
//-----------------------------------------------------------------------------------
-------
//
// ¡¾ÎļþÃû¡¿: c_check.inc
// ¡¾× ......
Ò»¸ö¼òµ¥µÄÀý×Ó¶ÁÈ¡CSVÎļþ£º
<?php
$handle=fopen("test.csv","r");
echo "<table border=2>";
//ÅäºÏwhileÑ»·¶ÁÈ¡Îļþ
while($data=fgetcsv($handle,1024))
{
list($user,$pwd,$partment,$title)=$data;
echo "<tr>
<td>$user</td>
<td>$pwd< ......
ÍíÉÏÌØÒ⻨Á˸öʱ¼ä£¬×Ô¼º¶¯ÊÖÊÔÁËÏ¡£
ÔÚÏîÄ¿ÖÐÒ»Ö±Åöµ½Cookie¿çÓò·ÃÎʼ°SessionId¿çÓò´«µÝÎÊÌâ
·¶Àý£º
index.php
<?php
include_once('a.php');
session_start();
$_SESSION['k'] = uniqid();
setcookie("sess", session_id(), time()+3600, "/", ".ipggg.com");
echo "index.php<br />\n";
echo $ ......