摘要: # 堆排序 def max_heap(heap,heapsize,i): # 构造最大堆(内部构建) left=2*i+1 right=2*i+2 larger=i if leftheap[larger]: larger=left if rightheap[larger]: larger=right if ... 阅读全文
posted @ 2019-08-18 20:31 reyinever 阅读(113) 评论(0) 推荐(0) 编辑
摘要: def perm(arry): if arry==[]: return [arry] resultList = [] for i in range(len(arry)): restArry=arry[:i]+arry[i+1:] for x in perm(restArry): resultList.... 阅读全文
posted @ 2019-08-17 18:32 reyinever 阅读(133) 评论(0) 推荐(0) 编辑
摘要: import queue """ 二叉搜索树: 特点:左子树的值小于根节点的值;右子树的值大于根节点的值 1.创建 2.插入节点 3.广度优先遍历 4.根据值查找节点 5.删除节点 """ class TreeNode(object): """定义树的节点""" def __init__(self, val): self.value = val ... 阅读全文
posted @ 2019-08-06 11:48 reyinever 阅读(416) 评论(0) 推荐(0) 编辑
摘要: from queue import Queue """二叉树: 1.深度遍历 2.广度遍历 """ class Node(object): def __init__(self, value, left=None, right=None): self.value = value self.left = left self.right =... 阅读全文
posted @ 2019-08-06 11:46 reyinever 阅读(652) 评论(0) 推荐(0) 编辑
摘要: def binary_search(arry,target): min=0 max=len(arry)-1 while min<=max: mid=int((min+max)/2) if target==arry[mid]: return mid elif target<arry[mid]: ... 阅读全文
posted @ 2019-08-06 11:37 reyinever 阅读(206) 评论(0) 推荐(0) 编辑
摘要: from jsonpath_rw import parse def get_key_from_data(key,data): # 定义匹配规则 json_expr=parse(key) result=json_expr.find(data) # [match.value for match in male][0] return [match.value ... 阅读全文
posted @ 2019-08-01 15:20 reyinever 阅读(169) 评论(0) 推荐(0) 编辑
摘要: (1)克隆、提交、拉取代码操作 $ git clone url 把仓库克隆到本地当前目录 $ git add filename 把代码放入git暂存区 $ git status 查看当前的代码修改状态 $ git commit -m “description” 把代码从暂存区存入仓库 $ git p 阅读全文
posted @ 2019-07-22 13:49 reyinever 阅读(96) 评论(0) 推荐(0) 编辑
摘要: import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; public class CopyFileDemo { public static void main(String[] args) { try( Fil... 阅读全文
posted @ 2019-07-02 14:12 reyinever 阅读(128) 评论(0) 推荐(0) 编辑
摘要: import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; public class FightAgainstLandlord { public static void main(String[] args) { //... 阅读全文
posted @ 2019-07-01 21:35 reyinever 阅读(336) 评论(0) 推荐(0) 编辑
摘要: public class RunnableImpDemo implements Runnable { @Override public void run() { System.out.println(Thread.currentThread().getName()); } } import java.util.concurrent.ExecutorSe... 阅读全文
posted @ 2019-07-01 21:31 reyinever 阅读(180) 评论(0) 推荐(0) 编辑