Dsy Network www | forum | my | didattica | howto | wiki | el goog | stats | blog | dona | rappresentanti
Homepage
 Register   Calendar   Members  Faq   Search  Logout 
.dsy:it. : Powered by vBulletin version 2.3.1 .dsy:it. > Didattica > Corsi N - Z > Programmazione > [PROGRAMMAZIONE] Successione Fibonacci (Ricorsione)
  Last Thread   Next Thread
Author
Thread    Expand all | Contract all    Post New Thread    Post A Reply
Collapse
T_M_P
.arcimaestro.

User info:
Registered: May 2003
Posts: 458 (0.06 al dì)
Location: Milano
Corso: Informatica
Anno: 1 (Finirà mai?)
Time Online: 2 Days, 7:52:34 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged
Question [PROGRAMMAZIONE] Successione Fibonacci (Ricorsione)

Qualcuno per caso ha fatto questo esercizio con la ricorsione? :sighsob:

Non so voi, ma io non ci ho capito molto.. :?

Postate la vostra risoluzione se ci siete riusciti..
:muhehe:

20-12-2003 16:54
Click Here to See the Profile for T_M_P Click here to Send T_M_P a Private Message Find more posts by T_M_P Add T_M_P to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
loreste
.grande:maestro.

User info:
Registered: Jan 2003
Posts: 730 (0.09 al dì)
Location: Berghem
Corso: Informatica
Anno: -2 alla specialistica
Time Online: 8 Days, 5:47:53 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Dimmi il problema e vedrò se posso aiutarti.
Ciao

__________________
La Fede non retrocede mai!
Döma Atalanta!!!!!!!!

20-12-2003 18:54
Click Here to See the Profile for loreste Click here to Send loreste a Private Message Find more posts by loreste Add loreste to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
recoil
dsy adminz

User info:
Registered: Mar 2002
Posts: 4454 (0.51 al dì)
Location: Milano / Erba
Corso: TICOM
Anno: laureato
Time Online: 61 Days, 16:17:45 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

fibonacci con la ricorsione è semplice

f = f(n - 1) + f (n - 2)
con f(0) = 0 e f(1) = 1

ti basta fare una funzione ricorsiva di questo tipo

int fibonacci(int n) {
if (n == 0 || n == 1)
return n;
return f(n - 1) + f(n + 1);
}

diventa un tantino più complicato farlo senza ricorsione, mi ricordo che ce lo aveva dato come esercizio la Rosti per architetture degli elaboratori (in assembly quindi) :)

__________________
Sono sempre alla ricerca di curriculum interessanti da segnalare alle società con cui ho contatti. Info in pm

20-12-2003 19:02
Click Here to See the Profile for recoil Click here to Send recoil a Private Message Visit recoil's homepage! Find more posts by recoil Add recoil to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
mark
.grande:maestro.

User info:
Registered: Oct 2003
Posts: 783 (0.10 al dì)
Location:
Corso: F49
Anno: finito!
Time Online: 8 Days, 18:34:33 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

in rete ci sono parecchi esempi ed il codice è pressochè uguale per tutti



code:
public class Fibonacci { public static long fibonacci(long i) { if (i == 0) return 0; else if (i == 1) return 1; else return fibonacci(i-1) + fibonacci(i-2); } public static void main(String[] args){ long i = 8; System.out.print("fibonacci(" + i + ") = " + fibonacci(i)); } }

Last edited by mark on 21-12-2003 at 10:15

20-12-2003 19:19
Click Here to See the Profile for mark Click here to Send mark a Private Message Find more posts by mark Add mark to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
ROYV
.primate.

User info:
Registered: Sep 2003
Posts: 74 (0.01 al dì)
Location: limbiate
Corso: Informatica
Anno: 1
Time Online: 1 Day, 19:36:01: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Guarda qui se ti puo' essere utile

20-12-2003 20:20
Click Here to See the Profile for ROYV Click here to Send ROYV a Private Message Find more posts by ROYV Add ROYV to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
T_M_P
.arcimaestro.

User info:
Registered: May 2003
Posts: 458 (0.06 al dì)
Location: Milano
Corso: Informatica
Anno: 1 (Finirà mai?)
Time Online: 2 Days, 7:52:34 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Grazie ragazzi!!

22-12-2003 11:02
Click Here to See the Profile for T_M_P Click here to Send T_M_P a Private Message Find more posts by T_M_P Add T_M_P to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
All times are GMT. The time now is 07:56.    Post New Thread    Post A Reply
  Last Thread   Next Thread
Show Printable Version | Email this Page | Subscribe to this Thread | Add to Bookmarks

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is ON
 

Powered by: vBulletin v2.3.1 - Copyright ©2000 - 2002, Jelsoft Enterprises Limited
Mantained by dsy crew (email) | Collabora con noi | Segnalaci un bug | Archive | Regolamento | Licenze | Thanks | Syndacate
Pagina generata in 0.111 seconds (63.94% PHP - 36.06% MySQL) con 26 query.