Research Article Open Access

A Fast Pattern Matching Algorithm with Two Sliding Windows (TSW)

Amjad Hudaib, Rola Al-Khalid, Dima Suleiman, Mariam Itriq and Aseel Al-Anani


In this research, we propose a fast pattern matching algorithm: The Two Sliding Windows (TSW) algorithm. The algorithm makes use of two sliding windows, each window has a size that is equal to the pattern length. Both windows slide in parallel over the text until the first occurrence of the pattern is found or until both windows reach the middle of the text. The experimental results show that TSW algorithm is superior to other algorithms especially when the pattern occurs at the end of the text.

Journal of Computer Science
Volume 4 No. 5, 2008, 393-401


Submitted On: 22 August 2008 Published On: 31 May 2008

How to Cite: Hudaib, A., Al-Khalid, R., Suleiman, D., Itriq, M. & Al-Anani, A. (2008). A Fast Pattern Matching Algorithm with Two Sliding Windows (TSW). Journal of Computer Science, 4(5), 393-401.

  • 25 Citations



  • Pattern matching
  • string matching
  • berry-ravindran algorithm
  • boyer moore