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
Ïà¹ØÎĵµ£º
Õâ¸öÎĵµ¼òµ¥½éÉÜÁËÔõôʹÓÃC++ΪPHP±àдһ¸öÀ©Õ¹Ä£¿é¡£ÎÒÒѾ±»Îʼ°Õâ¸öÎÊÌâÎÞÊý´ÎÁË£¬ËùÒÔÎÒ¾ö¶¨ÎªºóÀ´Õßдһ¸ö¼òµ¥µÄHOWTO¡£ÕâƪÎÄÕÂÖ»»á˵Ã÷һЩҪµãºÍ¹Ø¼üÖ®´¦£¬Èç¹ûÄãÏ£ÍûѧϰC++»òPHP£¬Çë²éÔÄÆäËüµÄÎĵµ¡£
˳±ã£¬ÔÚ±¾ÎÄÖÐÎÒÃÇÒ²»á¿´Ò»ÏÂÔÚPHP5ÖÐÔõô°ÑC++ÀàÓ°Éäµ½PHPÖС£ÎÄÕÂÖеÄÀý×Ó¿ÉÒÔÔÚPHP4ºÍPHP5µÄ»·¾³ÏÂÊ¹Ó ......
TIOBEÊÀ½ç±à³ÌÓïÑÔÅÅÐаñÕ¹ÏÖÁ˱à³ÌÓïÑÔµÄÁ÷ÐÐÇ÷ÊÆ¡£Ã¿¸öÔ£¬¶¼ÓÐ×îеÄÊý¾Ý±»¸üС£Õâ·ÝÅÅÐаñµÄÊý¾ÝÈ¡ÑùÀ´Ô´ÓÚ»¥ÁªÍøÉϸ»ÓоÑéµÄ³ÌÐòÔ±¡¢ÉÌ ÒµÓ¦Óá¢ÖøÃûµÄËÑË÷ÒýÇ棨ÖîÈç¹È¸è¡¢ MSN ¡¢ÑÅ»¢£©µÄ¹Ø¼ü×ÖÅÅÃû¡¢ Alexa ÉϵÄÅÅÃûµÈ¡£Çë×¢ÒâÕâ¸öÅÅÐаñÖ»ÊÇ·´Ó³ÁËij¸ö±à³ÌÓïÑÔµÄÈÈÃÅ³Ì¶È , Õâ²¢²»´ú±íËüÊÇÒ»¸ö×îºÃµÄ±à³ÌÓïÑÔ» ......
×î½üÔÚ×öÒ»¸öÏîÄ¿£¬Óöµ½AJAXÖÐÎÄÂÒÂëÎÊÌ⣬¾¹ýÒ»¸öÏÂÎçµÄŬÁ¦ÖÕÓÚÍêÃÀ½â¾ö£¬ÏÖ½«ÐĵÃдÏÂÀ´£¬Ï£Íû¶ÔÄÇЩ»¹À§ÈÆÔÚÕâ¸öÎÊÌâ¶øÍ·Í´²»ÒѵÄÈËÃÇÓÐËù°ïÖú¡£
ÖÚËùÖÜÖª£¬Ê¹ÓÃAJAX´«ËͺͽÓÊÕÖÐÎIJÎÊýʱ£¬Èç¹û²»ÔÚ¿Í»§¶ËºÍ·þÎñÆ÷×öÏàÓ¦µÄ´¦Àí¾Í»á³öÏÖÂÒÂëÎÊÌ⣬ÔÚÍøÉÏÏàÓ¦µÄÎÄÕÂÒ²²»ÉÙ£¬µ«ÊÇÓеÄÇé¿öϺÜÄÑ´ÓÖÐÕÒµ½·ûºÏ×Ô¼ºÀíÏëµÄ´ð ......
Ò»¸ö¼òµ¥µÄÀý×Ó¶ÁÈ¡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< ......
php°²×°
# tar xzvf php-5.2.5.tar.gz
# cd php-5.2.5
./configure --prefix=/home/redadmin/php --with-apxs2=/home/redadmin/apache/bin/apxs --with-mysql=/home/redadmin/mysql --enable-mbstring=all --enable-track-vars
# make && make install
# cp php.ini-dist /home/redadmin/php/lib/php.ini
# c ......