Question DSA-STR-0040
EasyIn the worst case, how long does naive (brute-force) pattern matching take for a text of length n and a pattern of length m?
- A.
O(m)
- B.
O(n·m)
- C.
Sign up free to see the answer and a step-by-step explanation.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Strings question
In the worst case, how long does naive (brute-force) pattern matching take for a text of length n and a pattern of length m?
O(m)
O(n·m)
Sign up free to see the answer and a step-by-step explanation.
O(log n)
O(n + m)