Question

The Knuth-Morris-Pratt (KM

  • P algorithm improves upon the Naive approach by avoiding unnecessary re-comparisons. It achieves this by:
A Using a hash function.
B Preprocessing the text to build a suffix tree.
C Preprocessing the pattern to build a "longest proper prefix which is also suffix" (LPS) array.
D Always shifting the pattern by 'M' positions.
E Comparing characters from right to left.
Practice Next

Hey! Ask a query

🎓
Think You're Ready for RBI Grade B?
RBI Grade B 2026 Phase 1 Memory Based Paper
  • 200 Questions with Detailed Solutions
  • Section-wise Coverage (GA, English, Quant & Reasoning)