Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / March 2006

Tip: Looking for answers? Try searching our database.

Need help with recursive problem.

Thread view: 
andrew.butt@gmail.com - 19 Mar 2006 21:07 GMT
Hello, I am a new programmer and am faced with a problem which I am not
totally sure how to start.  The problem is as follows:

====================================================

Using recursion, compute the area of a polygone.  Cut off a triangle
and use the fact that a triangle with corners (x1,y1), (x2,y2), (x3,
y3) has
area = |(x1)(y2) + (x2)(y2) + (x3)(y1) - (y1)(x2) - (y2x3) - (y3x1)|/2

The program will be testerd by redirecting a text file to its standard
input.  Such a file represent a polygone.  Within a file, each line
contains two (non-scientific notation) floating point number to
indicate the corrdinates of a vertex.
====================================================

My major problem is the recursive thought that it involves, I can
visualize doing this non-recursively quite easily, so if anyone could
offer any advice on how a recursive approach to this would be started I
would be very greatful.

Thanks.
Roedy Green - 19 Mar 2006 21:26 GMT
>Hello, I am a new programmer and am faced with a problem which I am not
>totally sure how to start.

see http://mindprod.com/jgloss/recursion.html

It will show you some examples of recursive code.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Thomas Weidenfeller - 20 Mar 2006 09:39 GMT
>> Hello, I am a new programmer and am faced with a problem which I am not
>> totally sure how to start.
>
> see http://mindprod.com/jgloss/recursion.html
>
> It will show you some examples of recursive code.

You forgot to point to

http://mindprod.com/jgloss/homework.html

The OP didn't even hide the original homework question. New programmer?
Well, what a creative definition for a student.

/Thomas

Signature

The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/

Oliver Wong - 20 Mar 2006 21:54 GMT
> Hello, I am a new programmer and am faced with a problem which I am not
> totally sure how to start.  The problem is as follows:
[quoted text clipped - 16 lines]
> offer any advice on how a recursive approach to this would be started I
> would be very greatful.

   How would you solve this non-recursively?

   - Oliver


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.