Suppose we have the following method (it is in c code):
const char *bitap_search(const char *text, const char *pattern)
My question is how can I compare text and pattern if they are char? This method is like a substring problem but I am confused a bit can I write in term of char such code?
if (text[i]==pattern[i])?
look i am interesting at this algorithm in java
http://en.wikipedia.org/wiki/Bitap_algorithm
how implement this in java?
R = malloc((k+1) * sizeof *R);
and please help me to translate this code in java
so we have two string text?
like “i like computer it is very important”
and patter string ” computer it is very”?
can anybody explain me what we have instead of char?
I think you are confused about the difference between
charandchar *. In C there is no built-in string type. Strings are represented as null-terminated character arrays, meaning that the last character of the string must be\0Socharis a single character, whilechar *is a pointer to an array of characters, i. e. a string. And that means that it is perfectly fine to sayif (text[i] == pattern[i]).