基础算法
chinrock
hello world
展开
-
python 装饰器
记录下python装饰器的作用,经常忘记这个,又回想不起来,肯定是因为少用。先上个简单的装饰器例子from functools import wrapsdef other_fun(func): print("开始执行other_fun") @wraps(func) def warrp(): print("开始执行warrp") func() print("执行完warrp") return warrp@other_f原创 2022-02-17 22:33:08 · 568 阅读 · 0 评论 -
python 实现简单的算法示例
def maopao(list): for i in range(len(list)): for j in range(len(list)): if list_shuzi[i]<list[j]: temp=list[j] list[j]=list[i] list[i]=temp print('冒泡排序后的列表:',list) return l原创 2021-04-01 21:04:16 · 182 阅读 · 0 评论 -
Java实现冒泡排序+二分法查找
记录一下基础的排序和查找:public class java_test { public static void main(String[] args) { //从键盘输入10个整数存入数组arry int[] array=new int[10]; System.out.println("请输入十个整数"); for(int i=0;i<array....原创 2019-06-23 12:43:52 · 404 阅读 · 0 评论