How Do I Optimize My KMP?

Revision en5, by coco_elon, 2016-06-03 00:40:56

NHAY is a SPOJ question involving pattern search. The Link: http://www.spoj.com/problems/NHAY/

My solution gives me TLE. Here is my code: https://ideone.com/A2N6An What are some optimizations that I can apply on my code?

Tags spoj, kmp

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en5 English coco_elon 2016-06-03 00:40:56 1059
en4 English coco_elon 2016-06-03 00:29:15 137
en3 English coco_elon 2016-06-03 00:27:11 143
en2 English coco_elon 2016-06-03 00:25:00 4 Tiny change: 'my code:\n#include' -> 'my code:\n\n\n#include'
en1 English coco_elon 2016-06-03 00:24:24 1277 Initial revision (published)