java - Is this brute-force algorithm NP-hard? -
Here is an animal-force algorithm that we use in a project management system to remove keywords from abstracts. What is the complexity of time of that brute force algorithm? Is it NP-NP, NP in full or P?
This is the algorithm:
  public static input search (string pattern, string text) {int m = pattern.length (); Int n = text.length (); For (int i = 0; i     
  to start with, only  problems  It may be necessary to ask  NP , or  NP  -Hard, or  NP  -complete, or  P  Is not it your special algorithm  NP  - HARD or  NP  --complete   You have a special algorithm that is simple string-searching algorithm. Looking at the length of a text string of length and a pattern string of length n, it runs in time o ((m - n + 1) n). This input is a polynomial in the shape of the string, and therefore this problem is related to string search problem - class  P   P  in  P  The problem is also in  NP , in the  NP , but it is not known whether this problem is  NP  or not - HARD or  NP  - Successful because by solving that question it will be decided that  P  =  NP .   It is appropriate to ask, when you find yourself forcefully, then your solution is very slow or the problem you are trying to solve can be solved more efficiently, And for this to see the problem and what is going on, it is very good. In your case, there are better algorithms for string search; Noth-Morris-Prat algorithm runs in the worst position O (M + N), which runs RUBIN-CARP algorithm on an average run in OB (M + N) and it is very easy to implement and Boyer Moore Running algorithms in many cases in the sub-timeline, however, the fact that your brute-force algorithms are not as efficient as these algorithms have nothing to do with  NP  -completeness.   
 
  
 
Comments
Post a Comment