Searching Substring in O(n) Time Complexity

[{“box”:0,”content”:”

n

Year : July 7, 2023 | Volume : 01 | Issue : 01 | Page : 09-16

n

n

n

n

n

n

By

n

[foreach 286]

Ilyas Shaikh, Abhay A. Nigadikar, Sharada Patil
  • [/foreach]

    n

    n

      [foreach 286] [if 1175 not_equal=””]n

    1. Student, Student, Associate Professor,MCA (Master of Computer Application), Sinhgad Institute of Business Administration and Research, Danny Mehata Nagar, Kondhwa Budruk, Pune, MCA (Master of Computer Application), Sinhgad Institute of Business Administration and Research, Danny Mehata Nagar, Kondhwa Budruk, Pune, MCA (Master of Computer Application), Sinhgad Institute of Business Administration and Research, Danny Mehata Nagar, Kondhwa Budruk, Pune,Maharashtra, Maharashtra, Maharashtra,India, Inida, India
    2. n [/if 1175][/foreach]

    n

    n

    Abstract

    n This research paper presents a highly efficient algorithm for substring search within a given string, achieving a remarkable time complexity of O(n). The proposed algorithm utilizes a two-pointer approach to compare the given string with the targeted substring. By employing string concatenation, the algorithm dynamically constructs a resultant substring during the matching process. Upon completion of character matching, the algorithm compares the resultant substring with the targeted substring and returns the index position when a match is found. The main advantage of this algorithm is to search through the main string in linear time, outperforming alternative algorithms with higher time complexities such as O(n^2) or O(m*n). The practical applications of this algorithm are diverse, spanning text processing, pattern matching, and data analysis. The efficiency and effectiveness of the algorithm make it a valuable tool in various domains where rapid and accurate substring search is required. By introducing this algorithm, the research paper offers a substantial contribution to the field of string processing, addressing the need for efficient substring search techniques. The experimental evaluation of the algorithm demonstrates its superior performance compared to existing approaches, highlighting its potential for enhancing computational tasks that involve string manipulation. The presented algorithm opens new possibilities for improving efficiency and scalability in applications that rely on substring search operations, contributing to advancements in text mining, information retrieval, and data analytics.n

    n

    n

    n

    Keywords: Substring search, Algorithm, Time complexity, Linear time, O(n), Two pointers, String concatenation,

    n [if 424 equals=”Regular Issue”][This article belongs to International Journal of Algorithms Design and Analysis Review(ijadar)]n

    n

    [/if 424][if 424 equals=”Special Issue”][This article belongs to Special Issue under section in International Journal of Algorithms Design and Analysis Review(ijadar)][/if 424][if 424 equals=”Conference”]This article belongs to Conference [/if 424]

    n

    n

    n

    How to cite this article:n Ilyas Shaikh, Abhay A. Nigadikar, Sharada Patil Searching Substring in O(n) Time Complexity ijadar July 7, 2023; 01:09-16

    n

    How to cite this URL: Ilyas Shaikh, Abhay A. Nigadikar, Sharada Patil Searching Substring in O(n) Time Complexity ijadar July 7, 2023n {cited July 7, 2023};01:09-16. Available from: https://journals.stmjournals.com/ijadar/article=July 7, 2023/view=0/

    n


    n

    Full Text

    n [if 992 equals=”Open Access”] n [else]n n var fieldValue = “[user_role]”;n if (fieldValue == ‘indexingbodies’&’administrator’) {n document.write(‘

    Full Text: 1

    ‘);n document.write(‘

    1

    ‘);n }n }else if (fieldValue == ‘ijadar’) {n document.write(‘

    3

    ‘);n }else {n document.write(‘ ‘);n }n [/if 992]n


    nn [if 379 not_equal=””]n

    Browse Figures

    n

    n

    [foreach 379]n

    n [/foreach]n

    nn

    n

    n [/if 379]n

    n

    n Referencesn

    n [if 1104 equals=””]n

    1. Aho, A.V., and Corasick, M.J. Fast pattern matching: An aid to bibliographic search. Comm. ACM 18, 6 (June, 1975), 333-340.
    2. Damiani A, Masciocchi C, Lenkowicz J, Capocchiano ND, Boldrini L, Tagliaferri L, Cesario A, Sergi P, Marchetti A, Luraschi A, Patarnello S. Building an artificial intelligence laboratory based on real world data: the experience of gemelli generator. Frontiers in Computer Science. 2021 Dec 7;3:768266.
    3. Rahim R, Ahmar AS, Ardyanti AP, Nofriansyah D. Visual Approach of Searching Process using Boyer-Moore Algorithm. InJournal of Physics: Conference Series 2017 Dec 1 (Vol. 930, No. 1, p. 012001). IOP Publishing.
    4. Knuth DE, Morris, Jr JH, Pratt VR. Fast pattern matching in strings. SIAM journal on computing. 1977 Jun;6(2):323-50.
    5. Namjoshi K, Narlikar G. Robust and fast pattern matching for intrusion detection. In2010 Proceedings IEEE INFOCOM 2010 Mar 14 (pp. 1-9). IEEE.
    6. Gurung D, Chakraborty UK, Sharma P. Intelligent predictive string search algorithm. Procedia Computer Science. 2016 Jan 1;79:161-9.
    7. Carmosino ML, Gao J, Impagliazzo R, Mihajlin I, Paturi R, Schneider S. Nondeterministic extensions of the strong exponential time hypothesis and consequences for non-reducibility. InProceedings of the 2016 ACM Conference on Innovations in Theoretical Computer Science 2016 Jan 14 (pp. 261-270).
    8. March SD, Jones AH, Campbell JC, Bank SR. Multistep staircase avalanche photodiodes with extremely low noise and deterministic amplification. Nature Photonics. 2021 Jun;15(6):468-74.
    9. Hume A, Sunday D. Fast string searching. Software: Practice and Experience. 1991 Nov;21(11):1221-48.
    10. Hooimeijer P, Veanes M. An evaluation of automata algorithms for string analysis. InVerification, Model Checking, and Abstract Interpretation: 12th International Conference, VMCAI 2011, Austin, TX, USA, January 23-25, 2011. Proceedings 12 2011 (pp. 248-262). Springer Berlin Heidelberg.

     

    nn [/if 1104][if 1104 not_equal=””]n

      [foreach 1102]n

    1. [if 1106 equals=””], [/if 1106][if 1106 not_equal=””],[/ifn 1106]
    2. n [/foreach]n

    n [/if 1104]n

    nn


    n [if 1114 equals=”Yes”]n

    n [/if 1114]nnn

    n

    n

    Regular Issue Subscription Review Article

    n

    n

    n

    n

    n

    n

    n

    n

    n

    n

    n

    n

    n

    n

    n

    n

    n

    n

    n

    n

    n

    n

    n

    n

    n

    n

    Volume 01
    Issue 01
    Received May 30, 2023
    Accepted June 14, 2023
    Published July 7, 2023

    n

    n

    n

    n

    [if 1190 not_equal=””]n

    Editor

    n

    [foreach 1188]n

    n [/foreach]n

    n [/if 1190] [if 1177 not_equal=””]n

    Reviewer

    n

    [foreach 1176]n

    n [/foreach]n

    n [/if 1177]n

    n

    n

    nnn.mq{ndisplay: flex; justify-content: space-between; width: 1280px; margin: auto; padding:4px 8px;}n .flx {display: flex;}n.jcsb {justify-content: space-between;}n.w1280 {width: 1280px; margin: auto;}n.w75p {width: 74%; padding:4px 4px 4px 8px;}n.w25p {width: 24%; border-left: 1px solid gainsboro;}n.dvct {border: 1px solid navajowhite;n padding: 4px;n margin-bottom: 4px;n background: #43ff86;}n.post-views {text-align: center;}n.ALLreveiwers img,n .ALLeditors img {n width: 50px;n height: 50px;n border-radius: 50px;n margin: 10px;n } n.ALLreveiwers,n .ALLeditors {n border-bottom: 1px solid black;}n.modaltext {n color: white;n padding: 0px 30px 0px 30px;n text-decoration: none;n }n.modaltext:hover {n color: black;n background-color: rgb(255 221 204);n color: black;n }n.modal-content {n margin-top: 50%;n }n table,n tr,n td {n padding: 10px;n border: none;n }n h2 {n font-size: 16px !important;n font-family: ‘Roboto’, Slab !important;n line-height: 1.4em;n }n h3 {n font-size: 16px !important;n font-family: ‘Roboto’, Slab !important;n }n h4 {n font-family: ‘Roboto’, Slab !important;n }n p {n font-size: 14px !important;n font-family: ‘Roboto’, Slab !important;n }n a {n color: blue;n font-size: 15px !important;n font-family: ‘Roboto’, Slab !important;n }n li,n p {n font-size: 15px !important;n font-family: ‘Roboto’, Slab !important;n text-align: justify;n }n .authdiv img {n max-width: 17px;n max-height: 17px;n }n.authdiv {n display: flex;n padding: 1px 2px;n }n@media only screen and (max-width:768px){n.mq{display:block; width:100%; padding:4px;}n.w75p{width:100%;}n.w25p{width:100%;}n}nnn function myFunction2() {n var x = document.getElementById(“browsefigure”);n if (x.style.display === “block”) {n x.style.display = “none”;n }n else { x.style.display = “Block”; }n }n document.querySelector(“.prevBtn”).addEventListener(“click”, () => {n changeSlides(-1);n });n document.querySelector(“.nextBtn”).addEventListener(“click”, () => {n changeSlides(1);n });n var slideIndex = 1;n showSlides(slideIndex);n function changeSlides(n) {n showSlides((slideIndex += n));n }n function currentSlide(n) {n showSlides((slideIndex = n));n }n function showSlides(n) {n var i;n var slides = document.getElementsByClassName(“Slide”);n var dots = document.getElementsByClassName(“Navdot”);n if (n > slides.length) { slideIndex = 1; }n if (n (item.style.display = “none”));n Array.from(dots).forEach(n item => (item.className = item.className.replace(” selected”, “”))n );n slides[slideIndex – 1].style.display = “block”;n dots[slideIndex – 1].className += ” selected”;n }nnn function myfun() {n x = document.getElementById(“editor”);n y = document.getElementById(“down”);n z = document.getElementById(“up”);n if (x.style.display == “none”) {n x.style.display = “block”;n }n else {n x.style.display = “none”;n }n if (y.style.display == “none”) {n y.style.display = “block”;n }n else {n y.style.display = “none”;n }n if (z.style.display == “none”) {n z.style.display = “block”;n }n else {n z.style.display = “none”;n }n }n function myfun2() {n x = document.getElementById(“reviewer”);n y = document.getElementById(“down2”);n z = document.getElementById(“up2”);n if (x.style.display == “none”) {n x.style.display = “block”;n }n else {n x.style.display = “none”;n }n if (y.style.display == “none”) {n y.style.display = “block”;n }n else {n y.style.display = “none”;n }n if (z.style.display == “none”) {n z.style.display = “block”;n }n else {n z.style.display = “none”;n }n }n”}]