07 2022 档案

摘要://插入排序 function insertSort($array) { $n=count($array);//获取排序数组的长度 for($i=1;$i<$n;$i++){ $do=$array[$i];//准备排序的数值 //一直往左边找,比待排序大的数都往后挪,腾空位给待排序插入 for ($ 阅读全文
posted @ 2022-07-26 15:45 leo0362 阅读(71) 评论(0) 推荐(0) 编辑
摘要://冒泡排序-小到大 function bubbleSort($array){ $n=count($array);//获取排序数组的长度 //外层循环 for($i=0;$i<$n-1;$i++){ //内层循环 for ($j=0;$j<$n-$i-1;$j++){ //判断并交换 if($arr 阅读全文
posted @ 2022-07-26 14:04 leo0362 阅读(11) 评论(0) 推荐(0) 编辑
摘要://已经排序好的数组 二分查找--递归--返回数组的索引--返回-1 就是找不到 $left 最左边索引 $right--最右边索引 function twoFinds($array,$find,$left,$right){ //左边大于右边-超出查找范围-找不到数据 if($left>$right 阅读全文
posted @ 2022-07-26 10:17 leo0362 阅读(21) 评论(0) 推荐(0) 编辑
摘要:function funt1($n){ if($n<=1){ return $n; } return funt1($n-2)+funt1($n-1); } function funt2($n){ if($n<=1){ return $n; } $one=0; $two=1; $sum=0; for 阅读全文
posted @ 2022-07-25 20:31 leo0362 阅读(14) 评论(0) 推荐(0) 编辑
摘要:<!DOCTYPE html> <html> <head> <title></title> <meta http-equiv="content-type" content="text/html;charset=utf-8"> <style> p { text-align: left; padding 阅读全文
posted @ 2022-07-12 11:02 leo0362 阅读(79) 评论(0) 推荐(0) 编辑
摘要:package main import ( "fmt" "sync" ) var wg sync.WaitGroup func hello(i int) { defer wg.Done() fmt.Print(i, "hello hello\n") } func main() { for i := 阅读全文
posted @ 2022-07-10 12:01 leo0362 阅读(18) 评论(0) 推荐(0) 编辑
摘要:import socket def main(): client=socket.socket() client.connect(("127.0.0.1",8081)) while True: inputs=input(">>>").strip() client.send(len(inputs).to 阅读全文
posted @ 2022-07-09 18:45 leo0362 阅读(4) 评论(0) 推荐(0) 编辑
摘要:package main import ( "bufio" "fmt" "net" ) func process(conn net.Conn) { defer conn.Close() for { reader := bufio.NewReader(conn) var buf [124]byte n 阅读全文
posted @ 2022-07-09 18:36 leo0362 阅读(20) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示