- <?
- //——————–
- // 基本数据结构算法
- //——————–
- //二分查找(数组里查找某个元素)
- function bin_sch($array, $low, $high, $k){
- if ($low <= $high){
- $mid = intval(($low+$high)/2);
- if ($array[$mid] == $k){
- return $mid;
- }elseif ($k < $array[$mid]){
- return bin_sch($array, $low, $mid-1, $k);
- }else{
- return bin_sch($array, $mid+1, $high, $k);
- }
- }
- return -1;
- }
- //顺序查找(数组里查找某个元素)
- function seq_sch($array, $n, $k){
- $array[$n] = $k;
- for($i=0; $i<$n; $i++){
- if($array[$i]==$k){
- break;
- }
- }
- if ($i<$n){
- return $i;
- }else{
- return -1;
- }
- }
- //线性表的删除(数组中实现)
- function delete_array_element($array, $i)
- {
- $len = count($array);
- for ($j=$i; $j<$len; $j++){
- $array[$j] = $array[$j+1];
- }
- array_pop($array);
- return $array;
- }
- //冒泡排序(数组排序)
- function bubble_sort($array)
- {
- $count = count($array);
- if ($count <= 0) return false;
- for($i=0; $i<$count; $i++){
- for($j=$count-1; $j>$i; $j–){
- if ($array[$j] < $array[$j-1]){
- $tmp = $array[$j];
- $array[$j] = $array[$j-1];
- $array[$j-1] = $tmp;
- }
- }
- }
- return $array;
- }
- //快速排序(数组排序)
- function quick_sort($array) {
- if (count($array) <= 1) return $array;
- $key = $array[0];
- $left_arr = array();
- $right_arr = array();
- for ($i=1; $i<count($array); $i++){
- if ($array[$i] <= $key)
- $left_arr[] = $array[$i];
- else
- $right_arr[] = $array[$i];
- }
- $left_arr = quick_sort($left_arr);
- $right_arr = quick_sort($right_arr);
- return array_merge($left_arr, array($key), $right_arr);
- }
- //————————
- // PHP内置字符串函数实现
- //————————
- //字符串长度
- function strlen($str)
- {
- if ($str == '') return 0;
- $count = 0;
- while (1){
- if ($str[$count] != NULL){
- $count++;
- continue;
- }else{
- break;
- }
- }
- return $count;
- }
- //截取子串
- function substr($str, $start, $length=NULL)
- {
- if ($str=='' || $start>strlen($str)) return;
- if (($length!=NULL) && ($start>0) && ($length>strlen($str)-$start)) return;
- if (($length!=NULL) && ($start<0) && ($length>strlen($str)+$start)) return;
- if ($length == NULL) $length = (strlen($str) – $start);
- if ($start < 0){
- for ($i=(strlen($str)+$start); $i<(strlen($str)+$start+$length); $i++) {
- $substr .= $str[$i];
- }
- }
- if ($length > 0){
- for ($i=$start; $i<($start+$length); $i++) {
- $substr .= $str[$i];
- }
- }
- if ($length < 0){
- for ($i=$start; $i<(strlen($str)+$length); $i++) {
- $substr .= $str[$i];
- }
- }
- return $substr;
- }
- //字符串翻转
- function strrev($str)
- {
- if ($str == '') return 0;
- for ($i=(strlen($str)-1); $i>=0; $i–){
- $rev_str .= $str[$i];
- }
- return $rev_str;
- }
- //字符串比较
- function strcmp($s1, $s2)
- {
- if (strlen($s1) < strlen($s2)) return -1;
- if (strlen($s1) > strlen($s2)) return 1;
- for ($i=0; $i<strlen($s1); $i++){
- if ($s1[$i] == $s2[$i]){
- continue;
- }else{
- return false;
- }
- }
- return 0;
- }
- //查找字符串
- function strstr($str, $substr)
- {
- $m = strlen($str);
- $n = strlen($substr);
- if ($m < $n) return false;
- for ($i=0; $i<=($m–$n+1); $i++){
- $sub = substr($str, $i, $n);
- if (strcmp($sub, $substr) == 0) return $i;
- }
- return false;
- }
- //字符串替换
- function str_replace($substr, $newsubstr, $str)
- {
- $m = strlen($str);
- $n = strlen($substr);
- $x = strlen($newsubstr);
- if (strchr($str, $substr) == false) return false;
- for ($i=0; $i<=($m–$n+1); $i++){
- $i = strchr($str, $substr);
- $str = str_delete($str, $i, $n);
- $str = str_insert($str, $i, $newstr);
- }
- return $str;
- }
- //——————–
- // 自实现字符串处理函数
- //——————–
- //插入一段字符串
- function str_insert($str, $i, $substr)
- {
- for($j=0; $j<$i; $j++){
- $startstr .= $str[$j];
- }
- for ($j=$i; $j<strlen($str); $j++){
- $laststr .= $str[$j];
- }
- $str = ($startstr . $substr . $laststr);
- return $str;
- }
- //删除一段字符串
- function str_delete($str, $i, $j)
- {
- for ($c=0; $c<$i; $c++){
- $startstr .= $str[$c];
- }
- for ($c=($i+$j); $c<strlen($str); $c++){
- $laststr .= $str[$c];
- }
- $str = ($startstr . $laststr);
- return $str;
- }
- //复制字符串
- function strcpy($s1, $s2)
- {
- if (strlen($s1)==NULL || !isset($s2)) return;
- for ($i=0; $i<strlen($s1); $i++){
- $s2[] = $s1[$i];
- }
- return $s2;
- }
- //连接字符串
- function strcat($s1, $s2)
- {
- if (!isset($s1) || !isset($s2)) return;
- $newstr = $s1;
- for($i=0; $i<count($s); $i++){
- $newstr .= $st[$i];
- }
- return $newsstr;
- }
- //简单编码函数(与php_decode函数对应)
- function php_encode($str)
- {
- if ($str=='' && strlen($str)>128) return false;
- for($i=0; $i<strlen($str); $i++){
- $c = ord($str[$i]);
- if ($c>31 && $c<107) $c += 20;
- if ($c>106 && $c<127) $c -= 75;
- $word = chr($c);
- $s .= $word;
- }
- return $s;
- }
- //简单解码函数(与php_encode函数对应)
- function php_decode($str)
- {
- if ($str=='' && strlen($str)>128) return false;
- for($i=0; $i<strlen($str); $i++){
- $c = ord($word);
- if ($c>106 && $c<127) $c = $c-20;
- if ($c>31 && $c<107) $c = $c+75;
- $word = chr($c);
- $s .= $word;
- }
- return $s;
- }
- //简单加密函数(与php_decrypt函数对应)
- function php_encrypt($str)
- {
- $encrypt_key = 'abcdefghijklmnopqrstuvwxyz1234567890';
- $decrypt_key = 'ngzqtcobmuhelkpdawxfyivrsj2468021359';
- if (strlen($str) == 0) return false;
- for ($i=0; $i<strlen($str); $i++){
- for ($j=0; $j<strlen($encrypt_key); $j++){
- if ($str[$i] == $encrypt_key[$j]){
- $enstr .= $decrypt_key[$j];
- break;
- }
- }
- }
- return $enstr;
- }
- //简单解密函数(与php_encrypt函数对应)
- function php_decrypt($str)
- {
- $encrypt_key = 'abcdefghijklmnopqrstuvwxyz1234567890';
- $decrypt_key = 'ngzqtcobmuhelkpdawxfyivrsj2468021359';
- if (strlen($str) == 0) return false;
- for ($i=0; $i<strlen($str); $i++){
- for ($j=0; $j<strlen($decrypt_key); $j++){
- if ($str[$i] == $decrypt_key[$j]){
- $enstr .= $encrypt_key[$j];
- break;
- }
- }
- }
- return $enstr;
- }
- ?>
波比源码 – 精品源码模版分享 | www.bobi11.com
1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长!
2. 分享目的仅供大家学习和交流,您必须在下载后24小时内删除!
3. 不得使用于非法商业用途,不得违反国家法律。否则后果自负!
4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
5. 如有链接无法下载、失效或广告,请联系管理员处理!
6. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需!
7. 本站源码并不保证全部能正常使用,仅供有技术基础的人学习研究,请谨慎下载
8. 如遇到加密压缩包,请使用WINRAR解压,如遇到无法解压的请联系管理员!
波比源码 » 基本数据结构算法
波比源码 » 基本数据结构算法
buy levofloxacin 250mg online buy levofloxacin 250mg for sale
order suhagra 100mg sale generic suhagra 100mg order estrace 1mg online
order accutane 40mg without prescription order amoxicillin online order zithromax 250mg
order cialis 20mg for sale no prescription cialis order viagra 100mg for sale
order ramipril sale avapro 150mg price azelastine medication
buy buspirone generic oxybutynin 2.5mg order oxybutynin 5mg generic
alendronate tablet ibuprofen medication famotidine 20mg usa
buy olmesartan online cheap calan oral diamox online
buy generic zoloft Brand viagra viagra 100mg ca
order generic naltrexone 50 mg buy letrozole online cheap order aripiprazole without prescription
order cialis 5mg online cheap cheapest cialis online viagra pills 150mg
buy sporanox without prescription order tindamax 500mg generic tinidazole online
purchase clozaril clozaril buy online order decadron 0,0,5 mg online
tadalafil uk tadalafil drug viagra for sale online
buy cozaar 25mg without prescription cozaar generic topamax 200mg us
real money spins play slots san manuel casino online
fluconazole without prescription viagra 100mg generic sildenafil without prescription
generic sildenafil 50mg buy sildenafil 50mg online tadalafil 10mg generic
free slot play cialis 10mg sale tadalafil 20mg pills
sildalis pills buy estrace online purchase lamictal
no deposit free spins casino online blackjack casino brand modafinil 200mg
order biaxin 500mg sale buy clarithromycin 250mg for sale purchase meclizine pill
order naprosyn 250mg without prescription order omnicef pill lansoprazole order online
order albuterol 100mcg pantoprazole 40mg brand buy generic cipro 500mg
singulair 10mg brand buy singulair 10mg online cheap purchase sildenafil generic
cialis in usa Buy cialis once daily free slot games for fun
online casino real money paypal online casino games real money casino online blackjack
buy adalat 30mg pill adalat tablet buy allegra online cheap
buy ramipril 10mg generic glimepiride brand etoricoxib ca
doxycycline 200mg cheap albuterol tablet order cleocin without prescription
cheap olmesartan buy benicar 20mg pills order depakote 250mg online
clobetasol for sale online purchase clobetasol without prescription order amiodarone sale
order digoxin 250mg buy molnunat 200mg for sale buy molnupiravir 200mg online
generic amoxil 500mg order stromectol 6mg online ivermectin 3mg online
buy priligy 90mg online motilium over the counter oral motilium 10mg
indocin generic order generic indocin 50mg cenforce us
purchase doxycycline buy aralen 250mg for sale methylprednisolone 8 mg over the counter
tadacip order order tadalafil generic order trimox 250mg pill
tricor medication fenofibrate 160mg pills purchase sildenafil sale
esomeprazole capsules esomeprazole sale buy lasix 40mg pill
cialis india mail viagra ed remedies
purchase clomid sale buy generic clomid prednisolone 10mg brand
accutane 10mg price order accutane 10mg azithromycin medication
ventolin inhalator online order albuterol pills generic augmentin
order prednisolone pills buy gabapentin 100mg generic lasix 100mg price
vibra-tabs brand buy levitra 10mg online cheap acyclovir online order
uroxatral buy online diltiazem 180mg tablet purchase diltiazem sale
usa pharmacy viagra cialis women tadalafil 10mg price
order zetia 10mg online cheap brand zetia methotrexate 2.5mg oral
order warfarin for sale metoclopramide pill allopurinol pills
purchase levofloxacin generic buy ursodiol 150mg generic zyban generic
cenforce price buy cenforce 50mg generic buy glycomet 500mg pill
escitalopram for sale online revia 50 mg price naltrexone 50mg tablet
atorvastatin 80mg cost order atorvastatin 80mg pill viagra professional
female cialis tadalafil sildenafil 50mg for sale erection pills viagra online
cost of cialis brand name tadalafil generic ed drugs
order amoxil 250mg without prescription cheap prednisolone pill prednisolone 10mg generic
order generic prednisolone 20mg buy furosemide 40mg pill furosemide 100mg cost
buy allergy pills onlin ventolin 2mg pills cost synthroid 75mcg
buy serophene generic order clomid 50mg sale buy hydroxychloroquine 200mg generic
buy generic doxycycline for sale amoxiclav price amoxiclav cost
atenolol over the counter atenolol 50mg over the counter letrozole 2.5mg without prescription
buy cheap albenza order medroxyprogesterone 10mg generic cheap medroxyprogesterone 10mg
buy glucophage tablets cost metformin amlodipine cost
prinivil ca order zestril for sale order metoprolol pill
buy lyrica 75mg pills order generic lyrica 150mg buy dapoxetine 90mg sale
methotrexate 2.5mg brand metoclopramide 10mg price order generic metoclopramide
orlistat order orlistat over the counter zyloprim 100mg drug
purchase losartan pills buy hyzaar pill order topamax 200mg
order crestor 10mg generic ezetimibe order motilium where to buy
where to buy imitrex without a prescription order imitrex 25mg for sale purchase avodart online
sumycin 500mg tablet tetracycline 500mg pill baclofen 10mg sale
buy toradol online inderal over the counter order inderal 20mg online
clopidogrel 150mg pills cheap luvox 50mg purchase ketoconazole generic
vipspark.ru
buy combivent 100mcg decadron 0,5 mg drug linezolid 600 mg for sale
progesterone online buy order olanzapine 10mg generic olanzapine 10mg usa
bystolic 20mg brand buy clozaril 100mg sale clozapine 100mg canada
simvastatin online zocor pills viagra in usa
tegretol pill order tegretol generic order lincomycin 500 mg pills
order tadalafil 10mg online sildenafil original pfizer order oral viagra
duricef without prescription finasteride pills propecia medication
buy generic estradiol over the counter prazosin 2mg usa prazosin 2mg ca
buy flagyl pills metronidazole drug order keflex 500mg without prescription
purchase vermox generic tadalafil 10mg tablet tadalis 20mg for sale
buy nolvadex generic cost ceftin 250mg cefuroxime without prescription
buy trimox 250mg generic how to buy biaxin order biaxin generic
bimatoprost pills buy cheap generic methocarbamol buy trazodone for sale
clonidine 0.1mg sale catapres 0.1mg generic spiriva 9 mcg pill
azithromycin 250mg pill azithromycin 250mg canada order gabapentin 100mg sale
order furosemide 40mg sale oral doxycycline 100mg albuterol canada
ramipril canada buy arcoxia pill order etoricoxib 60mg generic
order levitra 20mg generic buy plaquenil 200mg pills order plaquenil 200mg pill
asacol pill azelastine 10ml drug buy irbesartan paypal
olmesartan 20mg cheap cost benicar 10mg order generic depakote 500mg
temovate order clobetasol oral purchase cordarone pills
buy diamox 250mg without prescription acetazolamide 250 mg sale order imuran 25mg generic
digoxin pills lanoxin 250 mg brand molnupiravir order
buy albuterol tablets buy pyridium tablets order pyridium 200 mg for sale
order singulair 5mg generic dapsone 100 mg sale order avlosulfon 100mg for sale
cheap baricitinib 4mg order metformin 1000mg buy lipitor online cheap
nifedipine sale fexofenadine ca buy fexofenadine 120mg online
order norvasc 5mg generic order lisinopril 10mg online cheap prilosec tablet
generic dapoxetine 90mg oral dapoxetine 30mg buy orlistat 60mg without prescription
order diltiazem online allopurinol for sale online buy allopurinol 100mg generic
triamcinolone canada brand loratadine 10mg buy claritin pills
buy generic rosuvastatin for sale order zetia 10mg generic order generic domperidone
how to buy tetracycline flexeril order purchase ozobax online cheap
buy trimethoprim medication cost keflex 125mg buy cleocin 300mg pills
order toradol online cheap where can i buy ketorolac inderal online buy
purchase plavix generic clopidogrel 75mg us medex generic
buy metoclopramide sale reglan 20mg pills buy generic nexium 40mg
buy budesonide no prescription bimatoprost over the counter purchase bimatoprost generic
buy aurogra tablets sildenafil for men buy estrace 2mg generic
spironolactone canada valtrex medication order valtrex
order finasteride 5mg generic buy finasteride for sale buy viagra tablets
tadacip order online buy tadacip online buy generic indomethacin 50mg
buy generic terbinafine online cefixime pill brand amoxicillin 500mg
buy arimidex 1 mg without prescription buy biaxin online cheap catapres 0.1 mg over the counter
divalproex ca divalproex 250mg without prescription order generic imdur 40mg
buy generic meclizine where can i buy meclizine buy minocycline online
buy generic movfor online cost omnicef 300mg cefdinir cheap
buy ed pills no prescription guaranteed viagra overnight delivery usa sildenafil tablet
prevacid 15mg canada buy albuterol 100mcg online cheap order pantoprazole 20mg online cheap
buying ed pills online buy sildenafil 50mg generic cialis for men
dapsone uk adalat 30mg pill buy perindopril 4mg online
fexofenadine buy online buy cheap amaryl amaryl 1mg ca
etoricoxib 120mg sale order mesalamine generic brand azelastine 10ml
terazosin buy online generic arava 10mg order cialis for sale
order irbesartan 300mg online buy clobetasol generic buspar pills
ditropan sale purchase oxytrol without prescription buy generic alendronate online
praziquantel price order hydrochlorothiazide 25 mg without prescription order cyproheptadine 4 mg for sale
cost furadantin 100mg nitrofurantoin price nortriptyline 25mg pills
luvox 50mg generic buy duloxetine sale buy duloxetine paypal
glipizide 10mg canada buy glipizide 10mg without prescription buy betamethasone 20gm sale
acetaminophen 500mg for sale buy generic famotidine generic famotidine 40mg
brand anafranil order anafranil 25mg online cheap buy prometrium generic
order tacrolimus 1mg without prescription cost remeron 30mg oral requip 2mg
valsartan 80mg pills order valsartan 160mg generic buy combivent 100 mcg online
buy decadron online cheap order starlix 120 mg pill nateglinide 120mg price
capoten 25 mg us carbamazepine price purchase carbamazepine generic
buy ciprofloxacin cheap ciprofloxacin brand duricef order
order seroquel 50mg without prescription brand lexapro escitalopram 10mg cheap
buy generic epivir buy lamivudine generic buy generic quinapril online
order sarafem without prescription order sarafem 40mg pill buy letrozole online
buy frumil 5mg generic buy frumil pill buy zovirax
buy generic zebeta over the counter order bisoprolol 5mg buy generic terramycin
valaciclovir 500mg sale bactrim 960mg brand floxin 200mg without prescription