随笔分类 -  python

摘要:二分图最大匹配数量,匈牙利算法求解 python,本质上是找增广回路 """ # File : hungary.py # Time :2022/8/28 21:08 # Author :notomato # Description: # """ ''' ''' # 六个点 # 第i个坐标存他相邻的点 阅读全文
posted @ 2022-08-29 12:55 Notomato 阅读(110) 评论(0) 推荐(0) 编辑
摘要:思路: 先转逆波兰,再求值 逆波兰求值的思路是,碰到数字入栈,碰到运算符则取栈顶两元素运算后入栈,最终栈内数字即为答案。 中缀表达式转为后缀表达式,即逆波兰表达式方法:对于中缀表达式的每个元素,遇到数字则直接加到结果上面,遇到操作符,若栈空或者当前操作符不小于栈顶操作符优先级(乘除大于加减),则入栈 阅读全文
posted @ 2022-08-27 19:01 Notomato 阅读(102) 评论(0) 推荐(0) 编辑
摘要:Python版本 class Trie: def __init__(self): self.children = defaultdict(Trie) self.word = "" self.is_word = False def insert(self, word): cur = self for 阅读全文
posted @ 2022-08-20 17:10 Notomato 阅读(26) 评论(0) 推荐(0) 编辑
摘要:下面是有用的参考链接 参考链接 阅读全文
posted @ 2022-05-25 14:38 Notomato 阅读(29) 评论(0) 推荐(0) 编辑
摘要:参考链接 python调用dll是,要使用绝对路径,不然会存在其他包import这个包是发生错误 import os from ctypes import * dllpath = os.path.abspath(r"D:\python********\****\**\*******.dll") dl 阅读全文
posted @ 2022-05-24 20:43 Notomato 阅读(173) 评论(0) 推荐(0) 编辑
摘要:python heapq相关操作 heapq 的一些常用方法: heapify(list)将列表转换为小根堆的数据结构。 heappush(heap, x),将 x 加入堆中。 heappop(heap),从堆中弹出最小的元素。 heapreplace(heap, x),弹出最小的元素,并将 x 加 阅读全文
posted @ 2022-05-19 16:50 Notomato 阅读(862) 评论(0) 推荐(0) 编辑

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