What is the time required to locate the occurrences of a pattern P of length m in a string of length n using suffix array?

Trang Esther

New member
What is the time required to locate the occurrences of a pattern P of length m in a string of length n using suffix array?
A. O(nm)
B. O(n$^{2}$)
C. O(mnlogn)
D. O(mlogn)
 
Answer: d
Explanation: Suffix arrays are used to find the occurrences of a pattern in a string. Pattern of length m will require m characters to compare, so using suffix array we can find occurrences of a pattern in the string of length n in O(mlogn) time.
 

Tìm kiếm

Back
Top