File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programming Diversions and the fly likes WordFinder redux ... String Searching Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Other » Programming Diversions
Bookmark "WordFinder redux ... String Searching" Watch "WordFinder redux ... String Searching" New topic
Author

WordFinder redux ... String Searching

Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
The wordfinder puzzle is already gone! I played a bit with a (possibly) faster string searcher. Back in the 80s I remember a lot of excitement about the Boyer-Moore search algorithm. It can be much faster than checking each position for a match, and gets even faster on longer search strings. Here's a description on Moore's Best Ideas page.

Rather than implement Boyer-Moore (which is awfully complicated) I took the first half of the algorithm from memory and made this.

with tester


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
 
Don't get me started about those stupid light bulbs.
 
subject: WordFinder redux ... String Searching
 
Similar Threads
June Newsletter Puzzle
How to do a fast substring search on an Array of strings?
How to mock a complicate content
Listing >> OOCalculator >> OOCalcTest
Comparable interface java 1.5