🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #7481

Re: recursive function ?

#7481
From: John McGrath TeamB
Date: Thu, 21 Jun 2001 06:20
41 lines
2419 bytes
On Wed, 20 Jun 2001 16:55:16 +0200, Steffen wrote:

> I'am going to realize a search-funtion which should find
> a part of a string in another string.

> I should code this in a recursive function.

I don't think you want to code this as a recursive function.  Recursion 
adds quite a bit of overhead, and it does not really gain you anything 
in this case.  Recursion should be avoided unless its use provides a 
clear benefit.

But unless the interest is academic, you are probably much better off 
using some code that has already been written, rather than roll your 
own.  Unless you know a lot about searching and have a lot of time on 
your hands, chances are that you will not be able to write a search 
algorithm better than what you can find already written.

One library that will do what you want is Jakarta ORO:

    http://jakarta.apache.org/oro/index.html

If the interest is academic, then a Java language newsgroup is not the 
best place to be looking.  In that case, one great place to start is 
Donald Knuth's classic "Art of Computer Programming" series.  You will 
find it in any library that has technical books, and if you have $130 
to spare, it would make a great addition to your computer science 
bookshelf.

Any search engine should also find plenty of material on search 
algorithms for you.  Be sure not to miss looking up the Boyer-Moore 
search algorithm.

-- 
Regards,

John McGrath [TeamB]

---------------------------------------------------
Before sending me e-mail, please read:
    http://www.JPMcGrath.net/newsgroups/e-mail.html
Technical Details
Message-ID: <MPG.159b5c30a5c9a6098a2c0@forums.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!isdnet!howland.erols.net!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews
References: <3b30b897_1@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,b3ee04a5fe26b94e
X-Google-Attributes: gidf74b3,public
X-Google-ArrivalTime: 2001-06-20 23:39:05 PST
From: John McGrath  [TeamB] <ng-b@JPMcGrath.net>
Newsgroups: borland.public.jbuilder.java.language
Subject: Re: recursive function ?
Date: Thu, 21 Jun 2001 02:20:36 -0400
Message-ID: <MPG.159b5c30a5c9a6098a2c0@forums.borland.com>
References: <3b30b897_1@dnews>
X-Newsreader: MicroPlanet Gravity v2.30
NNTP-Posting-Host: 209.92.40.60
X-Trace: dnews 993104434 209.92.40.60 (20 Jun 2001 23:20:34 -0700)
Lines: 41
X-Authenticated-User: jpmcgrath
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!isdnet!howland.erols.net!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews