Why do we not simply sort a string text T, and then use the binary search algorithm for each character in the pattern P to find a match?
a. Sorting the characters of the string text T would lose the position of the pattern P within the text T
b. Sorting would create an O(n log n) algorithm
c. String match would not work on a string with duplicate characters because of sorting
d. Sorting would be inefficient in the string matching algorithm
a. Sorting the characters of the string text T would lose the position of the pattern P within the text T
Sorting the characters of the string text T loses the positions of each character. The string text "concat" with the pattern "cat" when sorted gives "accnot" so the pattern "cat" is in the string text, but it is scrambled because of the sort.
You might also like to view...
Create an Active Server Page to delete messages from a forum. This ASP should take a f orum’s filename and t he timestamp o f the message as form arguments. Modify formatting. xsl to provide a link to the ASP for each message. [Hint: To remove an element’s child, use removeChild, with the node to remove as a parameter.]
What will be an ideal response?
What is the purpose of the address operator in C++?
A. There is no address operator in C++. B. To return the hexadecimal address of a variable. C. To report the system address for the program. D. To return the hexadecimal range for a datatype.
What RAID require minimum 4 drives
A. RAID 1 B. RAID 5 C. RAID 10 D. RAID 0
A list box typically displays ____ option(s).
A. no B. one C. at least two D. five or more