摘要: Give you a tree with N vertices and N‐ 1 edges, and then ask you Q queries on “which vertex is Y's son that has the smallest number and which vertex i 阅读全文
posted @ 2017-08-16 19:00 joeylee97 阅读(262) 评论(0) 推荐(0) 编辑
摘要: 适用于t[]串长度较小的情况,利用位运算一般比KMP算法快两倍以上。 用D来记录前缀的匹配情况,要使用Shift 算法,需要一个辅助表B。B 是一个字典,key 是问题域字符集中的每个字符,value 是一个n 位无符号整数,记录该字符在模式串T 的哪些位置出现。 由于D【j】表示的是T[0..J] 阅读全文
posted @ 2017-08-16 14:47 joeylee97 阅读(500) 评论(0) 推荐(0) 编辑