2 views

Uploaded by Zia Rehman

- Lab 1 Assignment.pdf
- Lecture+6
- Number Story
- hw8
- 5.3e
- Newton-Raphson Power Flow Implementation
- Project Management
- DSP-sharif university
- Paper 2 Solution
- Lecture 10
- APPLLICATIONS OF STACK-Tower of Hanoi
- Final Exam Artificial
- International Journal of Mechanical Sciences Volume 30 Issue 6 1988 [Doi 10.1016_0020-7403(88)90019-7] S.R. Reid -- CJ 88-02. a Study on Kinetic Accuracy of Planetary Gear Trains - By Wang Rensh
- sensors
- ACO Code With Ans
- Classification of Eeg Signals Using the Wavelet Transform - Digital Signal Processing Proceedings, 1997. DSP 97., 1997 13th International Conference On
- ITEM-ITEM Complete Lecture
- scalar+ vector + matrix clock- done
- Unit 2
- CE 335

You are on page 1of 1

Iftikhar Hussain, Muhammad Zubair, Jamil Ahmed and Junaid Zaffar

Abstract - In this research we introduce a new idea to solve the problem of exact pattern matching algorithm by using two pointers, simultaneously. Keywords - Algorithm, exact pattern matching, searching, Bidirectional. Case 4: If equal shifts of mismatched (either cause by right or left pointer) and right most characters are not found, and P(j )= T(m-1) is found at the left of mismatched character P(j) of the pattern, then align P(j ) with T(m-1). Case 5: If equal shifts of mismatched (either cause by right or left pointer) and the most right characters did not found at the left of mismatched character P(j) of the pattern then whole pattern will be shifted.

I. INTRODUCTION The aim of exact pattern matching algorithm is to find one or all occurrences of the pattern within a larger group of text string [3]. In this paper, we proposed a new Bidirectional exact pattern matching algorithm based on window sliding method of exact string matching problem which will be helpful in various needs of pattern matching. According to literature survey, all the authors focus to reduce the number of character comparisons and processing time in both worst/average cases. In this paper we compare Bidirectional algorithm's results with Boyer-Moore, BM Horspool, Quick Search, and Turbo BM algorithms which considered efficient in terms of number of character comparisons and attempts take to complete the processing of selected text. II. BIDIRECTIONAL ALGORITHM Bidirectional exact pattern matching algorithm compares a given pattern from both sides, starts from right then from left, one character at a time within the text window. In case of a mismatch or a complete match of the pattern, scan for the mismatched and right most characters of the text window to the left of the related text characters in pattern. When rightmost and mismatched characters found in the left of related characters of text string in pattern on same distance, then align pattern with that text window. A complete match will be found when the left pointer cross the right pointer at the middle of the pattern. Case 1: If mismatch cause by right pointer at most right position or by left pointer at most left position of pattern then scan for the rightmost character T(i+j-1) of the text window in the pattern from right to left. If character P(j ) found in the pattern then align character P(j ) with T(i+j-1). Case 2: If mismatch cause by right pointer at any position except most right position of the pattern then scan P(j-11) for character P(j ) which is same as T(i+j-1) and P(j ) same to T(i+m-1). If characters found in pattern on equal shifts then align character P(j ) with T(i+j-1) and P(j ) with T(i+m-1). Case 3: If mismatch cause by left pointer at any position except the most left position of pattern then scan P(j-11) for character P(j ) which is same as T(i+j-1) and P(j ) same to T(i+m-1). If characters found in pattern on equal shifts then align character P(j ) with T(i+j-1) and P(j ) with T(i+m-1).

Iftikhar Hussain, MSCS, Reg. 01713, IQRA University Islamabad. Plot No. 5, Khayaban-e-Johar, Sector H-9, Islamabad, Pakistan. E-mail: iftikhar.iftikhar786@gmail.com

. ANALYSIS OF BIDIRECTIONAL ALGORITHM The worst case time complexity of preprocessing phase of Bidirectional algorithm is O(m), because only one loop is used to scan the pattern to find the characters. The total time complexity of searching phase is O(mn/2), because O(n) takes to shift pattern to right of the text and O(m/2) to search pattern in text string. Bidirectional algorithm requires O(m) extra memory space in worst case in addition with the text and pattern string. IV. RESULTS AND DISCUSSIONS In graphical form, Fig. 1 shows total number of shifts taken by each algorithm using different pattern size. Results show that in short pattern number of shifts is closer to other algorithms but when pattern length is increased Bidirectional algorithm become more efficient.

500 450 400 350 300 250 200 150 100 50 0 4 6 8 10 12 14 16

No. of Shifts

Pattern length

Similarly, proposed algorithm compares more characters when pattern length is short. On long patterns, it takes less character compares than other algorithms. V. CONCLUSION This research presents a new idea of comparing the pattern with text string from both sides of the pattern simultaneously. Asymptotic analysis shows that Bidirectional algorithm is better than exiting algorithms, as it takes O(mn/2) time in searching phase. REFERENCES

[1] [2] R. S. Boyer, J. S. Moore, "A fast string searching algorithm," Communication of the ACM, Vol. 20, No. 10, 1977, pp.762772. Knuth, D., Morris, J. H., Pratt, V., "Fast pattern matching in strings," SIAM Journal on Computing, Vol. 6, No. 2, doi: 10.1137/0206024, 1977, pp.323350. Cormen, T.H., Leiserson, C.E., Rivest, R.L., Introduction to Algorithms, Chapter 34, MIT Press, 1990, pp 853-885.

[3]

- Lab 1 Assignment.pdfUploaded byMathew Musallam
- Lecture+6Uploaded byapi-3754855
- Number StoryUploaded bybigstrand4476
- hw8Uploaded bykalaputra
- 5.3eUploaded bytalhaaftab728
- Newton-Raphson Power Flow ImplementationUploaded bymikimaric
- Project ManagementUploaded byJaphet Repolledo
- DSP-sharif universityUploaded bysahar
- Paper 2 SolutionUploaded byFeng Zhaolun
- Lecture 10Uploaded byKajal Khan
- APPLLICATIONS OF STACK-Tower of HanoiUploaded byMAYA
- Final Exam ArtificialUploaded byZaidB
- sensorsUploaded byWolflan Freitas
- International Journal of Mechanical Sciences Volume 30 Issue 6 1988 [Doi 10.1016_0020-7403(88)90019-7] S.R. Reid -- CJ 88-02. a Study on Kinetic Accuracy of Planetary Gear Trains - By Wang RenshUploaded byjavad
- ACO Code With AnsUploaded bymuqueet1
- Classification of Eeg Signals Using the Wavelet Transform - Digital Signal Processing Proceedings, 1997. DSP 97., 1997 13th International Conference OnUploaded byCamila Cediel
- ITEM-ITEM Complete LectureUploaded byWaqar Khan
- scalar+ vector + matrix clock- doneUploaded byYash Chaudhary
- Unit 2Uploaded byMani Krish
- CE 335Uploaded byAmarilis Ramos
- 4_StartingValuesInLISREL.pdfUploaded byRocio Gill
- rubiks 4x4Uploaded byMark Anthony Baes Enoy
- Automatic Job Offer Processing (0fcfd50c9d596dd71a000000)Uploaded byShark
- MaskingUploaded byReynold Ralph Paul
- MeaUploaded bynikhil dwivedi
- CS446_S06_4_Scheduling2Uploaded byBhupesh Moyal
- Driver LCD1Uploaded bydiexboy
- DFSalgoUploaded bysatishreddy7899
- Incremental HullUploaded bysonal
- art-3A10.1007-2Fs40815-016-0277-7.pdfUploaded byTarak Benslimane

- Assembler Tutorial.ppsUploaded byTegar Herdantyo Putra
- A PROBABILISTIC MODEL FOR PREDICTING SOFTWARE DEVELOPMENT EFFORT.docUploaded byRamsathaya
- CS502Uploaded byaftabyousuf
- Vc Curriculum Vitae_final Sept 2015Uploaded byIkeazor Nwaobi
- Sample Personal Statement for Computer ScienceUploaded bydedejohn
- Addressing Modes of 8085Uploaded byetfs4india
- Requirement AnalysisUploaded byvtrajan_vis
- 2013(4.5-36)Uploaded byRuel C. Dogma
- C programming question setUploaded byPradip Kr Sharma
- A Survey of Programming TechniquesUploaded byTalha Mujahid
- Mainframe Assembler TranslationUploaded byAlaEddineDridi
- Lesson 2Uploaded byVaibhav Nandwani
- 1Requirements_Elicitation1.pptxUploaded byJason Lo
- Compiler 22Uploaded byapi-26413529
- CPU DesignUploaded byhumaxnerd
- Using DesignPatternsUploaded bySuresh
- FOCA Chapter 1 HandoutUploaded bylistenbr
- Design of An Efficient Neural Key GenerationUploaded byAdam Hansen
- Chap-1.pptxUploaded bySandipsinh Vaghela
- 5 Stage PipelineUploaded bySreenivas Murthy
- Sameep Tandon, WebUploaded bysameeptandon
- D Cloud Course 303 Materials Course 849 CD-HomeAssignmnt-TY-Updated.doc-1Uploaded byRaghav Singhania
- 01_introduction.pdfUploaded byNitesh Shinde
- Chapter 1Uploaded byhimvar1
- Software EngineeringUploaded bycoastudies
- venu-phd resumeUploaded byengineeringwatch
- Lecture5 Introduction to Process ManagementUploaded bysherpard muzuva
- IAP Cloud ControlUploaded bySheikhAbdulBasit
- Course Focus - 14 April 2015Uploaded byTimes Media
- SrsUploaded byAbhishekRai