Given two strings u and v and text T,i need help to find whether there is an occurrence of u and v interwoven in T, possibly with spaces. For example, the strings abac and bbc occur interwoven in cabcbabdcca (cabcbabdcca) along with other characters (in black). i tried to implement this but i'm stuck ! i hope someone here can help me

Recommended Answers

All 6 Replies

what computer language -- e.g. c++, c, vb, java, assembly, cobol, fortran, etc. etc.

any language

write a function that returns true of false that indicates if one string is contained in another string. For example if "hello" is contained in "hello world". You can call that function as many times as you wish. If you have two strings "hello" and "world" call the function for each word to find out whether or not they are contained in a third string "hello world".

For example, the strings abac and bbc occur interwoven in cabcbabdcca (cabcbabdcca) along with other characters (in black).

The color doesn't show up so I am not sure what you mean by "interwoven"? Please give a better example or try to add ASCII visual instead.

Tayein -do you undestand in computer biological?

No, I don't understand the word "computer biological." But if it is similar to a DNA sequence (as 'abc' is a molecule sequence consists of a, b, and c), then I understand what it is. However, when you use the word "interwoven," and said you have added color to the display, I am not sure how you want the result to be?

By the way, a computer language is trivia in your case but algorithm is. In this case, it is not that easy when there is a possibility of multiple appearances of substring in a string. If a brute force algorithm is suffice, then it would not be too difficult.

//i.e.
//String T = "cabcbabdcca";
//String u = "abac";
//String v = "bbc";
//Result of scanning string u in T   | Result of scanning string v in T
// cabcbabdcca                       |  cabcbabdcca
//  12  3  4                         |    12    3
// cabcbabdcca                       |  cabcbabdcca
//  12  3   4                        |    12     3
// cabcbabdcca                       |  cabcbabdcca
//  1  23  4                         |    1     23
// cabcbabdcca                       |  cabcbabdcca
//  1  23   4                        |      1   23
//                                   |  cabcbabdcca
//                                   |        1 23
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.