摘要: ![p1](https://tva1.sinaimg.cn/large/007S8ZIlgy1ghyreie6cnj30u013ch5k.jpg) ![p2](https://tva1.sinaimg.cn/large/007S8ZIlgy1ghyreh52fjj30u012549i.jpg) ![p3](https://tva1.sinaimg.cn/large/007S8ZIlgy1ghyre 阅读全文
posted @ 2020-08-21 21:36 MrDoghead 阅读(110) 评论(0) 推荐(0) 编辑
摘要: 最近遇到了这个问题就记录一下 import numpy as np top_k=3 arr = np.array([1, 3, 2, 4, 5]) top_k_idx=arr.argsort()[::-1][0:top_k] print(top_k_idx) #[4 3 1] 阅读全文
posted @ 2020-08-21 20:00 MrDoghead 阅读(4364) 评论(0) 推荐(3) 编辑
摘要: ![p1](https://tva1.sinaimg.cn/large/007S8ZIlgy1ghynfd6phhj30u012z4ln.jpg) ![p2](https://tva1.sinaimg.cn/large/007S8ZIlgy1ghynfcbexwj30u0138e3e.jpg) ![p3](https://tva1.sinaimg.cn/large/007S8ZIlgy1ghynf 阅读全文
posted @ 2020-08-21 19:19 MrDoghead 阅读(102) 评论(0) 推荐(0) 编辑
摘要: 算法思路 Knuth-Morris-Pratt(KMP)算法是解决字符串匹配问题的经典算法,下面通过一个例子来演示一下: 给定字符串"BBC ABCDAB ABCDABCDABDE",检查里面是否包含另一个字符串"ABCDABD"。 从头开始依次匹配字符,如果不匹配就跳到下一个字符 直到发现匹配字符 阅读全文
posted @ 2020-08-21 18:04 MrDoghead 阅读(853) 评论(0) 推荐(0) 编辑