Skip to content
Advertisement

How to Implemented Knutt Morris Pratt Algorithm in Laravel?

i have trouble understanding this implementation KMP algorithm in laravel is there a way to implemented KMP Algorithm into laravel app based?

i want to convert this script from native into framework script i seem cant find anything in google about Knutt Morris Pratt implemented in laravel based

JavaScript

i need to use this code because my essay need me to implemented at least 1 algorithm in my web apps and i want to use it for finding string

Advertisement

Answer

Laravel uses a structure called PSR4

Create a folder called Services under app and create a new file, call it KMP.php

JavaScript

Now run composer du in your terminal which will dump the autoload file and look for new files.

then you can use it like so.. in your routes for instance

web.php

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement