You are not logged in. Please login at www.codechef.com to post your questions!

×

Difference Between str.find() in C++ and matching algorithms like KMP etc. and strstr() in C ?

What Is The Difference Between This STL Function and These KMP Algorithms.. and also function strstr() in c

asked 13 Oct '15, 11:33

goyal_banna's gravatar image

3★goyal_banna
585414
accept rate: 8%

edited 26 Oct '15, 14:10

admin's gravatar image

0★admin ♦♦
19.8k350498541


In general the answer will be: It depends on the implementation. For the gnu compiler you can look it up for yourself in the source code of gcc or glibc. I had a short look at the glibc version of strstr. They seem to use the naive algorithm for short strings and some kind of improved version of KMP for linger strings. So in essence if you're just looking for a substring, there is no reason to implement something like KMP because the library version will be roughly as fast as yours.

link

answered 13 Oct '15, 20:38

ceilks's gravatar image

7★ceilks
1.8k9
accept rate: 36%

Great stuff from you, Ive read your stuff before and you’re just too awesome. But I really enjoyed the article. buy cheap essays

link

answered 14 Oct '15, 12:50

skorniaalison's gravatar image

0★skorniaalison
-1
accept rate: 0%

Very interesting, I can ask about this, my friends. Moreover, I was really confused a little by it.But I can share with you a great topic, which helps me a lot. What do you do when you have no time left to complete or start your term paper? You can start your term paper here - termpapers.kinja.com/

link

answered 23 Mar '16, 15:44

roark159's gravatar image

0★roark159
-1
accept rate: 0%

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×643
×278

question asked: 13 Oct '15, 11:33

question was seen: 2,995 times

last updated: 23 Mar '16, 15:44