What is a time complexity for x pattern occurrence of length n?

(a) O (log n!)

(b) Ɵ (n!)

(c) O (n^2)

(d) Ɵ (n + x)

I want to ask this question from Suffix tree topic in portion Trie of Data Structures & Algorithms I

I have been asked this question in an online quiz.

1 Answers

The correct option is (d) Ɵ (n + x)

The explanation is: Suffix tree is also known as PAT tree or position tree. It allows fast string operation. To check if a substring is present in a string of a length of n, the time complexity for such operation is found to be O (n). The time complexity for x pattern occurrence of length n is Ɵ (n + x).