由买买提看人间百态

topics

全部话题 - 话题: lsub
(共0页)
s*******f
发帖数: 1114
1
来自主题: JobHunting版 - 问个anagram的算法题
This is O(n). Hard to explain, but i think it deserve to go through it with
your test case.
//zzzz码遍本版,回报本版zzzz
//在一个大串中查找和另外一个字符串是anagram的子串:
//GetAnagram("abcdbcsdaqdbahs", "scdcb") ==> "cdbcs"
string GetAnagram(const char *s, const char *sub){
int ls = strlen(s);
int lsub = strlen(sub);
if (ls < lsub || lsub < 1)
return "";
int mp[256];
memset(mp, 0, 256 * sizeof(int));
while (*sub){
++mp[*sub++];
}
const char *p = s;
int count = 0;
whil... 阅读全帖
S***y
发帖数: 186
2
来自主题: Computation版 - 再问一个fortran的问题

ifc -c sub1.f90
ifc -c sub2.f90
ifc -c sub3.f90
ar qv libsub.a sub1.o sub2.o sub3.o
ifc your_prog.f90 -o your_exec -L.... -lsub
(共0页)