t*****s 发帖数: 416 | 1 比如
1.1检查一个串有没有重复字符如果charset小的话根据抽屉原理时间是O(1)
4.7检查一个小的二叉树是不是一个大二叉树的子树可以当字符串用KMP | b*****n 发帖数: 482 | 2
Cool, it's a clever move. It will solve the scenarios where the string
length is larger than 256 (assume the char set is ASCII). You will still
need to do some necessary work for the case of string length less than
256.
That was a solution without using extra memory. KMP is great when you
already have two strings, while in this case, what you've got are two
trees (need extra memory to convert them into strings) and the data might
not be characters.
【在 t*****s 的大作中提到】 : 比如 : 1.1检查一个串有没有重复字符如果charset小的话根据抽屉原理时间是O(1) : 4.7检查一个小的二叉树是不是一个大二叉树的子树可以当字符串用KMP
|
|