Research Article
An Improved Hashing Approach for Biological Sequence to Solve Exact Pattern Matching Problems
Algorithm 2
Searching of HAPM (T, P).
(1) | start_ind ⟵ 0, d ⟵ m/2, end_ind ⟵ m − 1 | (2) | while (text_size! = 0) | (3) | if t [start_ind] = p[0] | (4) | //Create substring based on pattern length | (5) | for (i = 0 to m) do | (6) | sum ⟵ ASCII (si) | (7) | end for loop | (8) | //Create hash value using predefined prime number | (9) | h (s) ⟵ sum mod q | (10) | //Create quotient value using predefined prime number | (11) | r (s) ⟵ sum divide q | (12) | if h(p) = h(s) and r(p) = r(s) | (13) | if t [start_ind + m − 1] = p[m − 1] | (14) | for (i = start_ind + 1 to d) do | (15) | if t[i]! = p[i] or t[m − i − 1]! = p[m − i] | (16) | break | (17) | end if | (18) | end for loop | (19) | end if | (20) | end if | (21) | if every character is matched | (22) | then the pattern found occurs | (23) | end if | (24) | shift_val ⟵ QsBc [text [end_ind + 1]] | (25) | start_ind ⟵ start_ind + shift_val | (26) | end_ind ⟵ start_ind + m − 1 | (27) | end while |
|