第3讲 堆栈、队列和字符串.ppt

void get_nextval(SString T, int nextval[]) { i = 1; nextval[1] = 0; j = 0; while (i T[0]) { if (j = 0 || T[i] == T[j]) { ++i; ++j; if (T[i] != T[j]) nextval[i] = j; else nextval[i] = nextval[j]; } else j = nextval[j]; } } // get_nextval 串C++实现 class String { public: // methods of the string ADT String(); ~String(); String (const String copy); // copy constructor String (const char * copy); // conversion from C-string String (Listchar copy); // co

文档评论(0)

1亿VIP精品文档

相关文档