0

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

3
Contributors
6
Replies
7
Views
5 Years
Discussion Span
Last Post by Taywin
0

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".

Edited by Ancient Dragon

0

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.

0

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

Edited by Taywin

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.