Java program to print Fibonacci sequence Recursive & Non Recursive

Monday, February 7th, 2011  »  Posted By  »  Total 3 Comments

The Fibonacci sequence is defined by the following rule. The first 2 values in the sequence are 1, 1. Every subsequent value is the sum of the 2 values preceding it. Write a Java program that uses both recursive and non-recursive functions to print the nth value of the Fibonacci sequence. 1 2 3 4 [...]

C++ program that uses non-recursive functions to traverse a binary tree in In-order

Thursday, March 11th, 2010  »  Posted By  »  Total 0 Comment

/* Write C++ program that uses non-recursive functions to traverse a binary tree in In-order */ #include<iostream> #include<conio.h> #include<stdlib.h> using namespace std; class node { public: class node *left; class node *right; int data; };   class tree: public node { public: int stk[50],top; node *root; tree() { root=NULL; top=0; } void insert(int ch) { [...]

C++ program that uses non-recursive functions to traverse a binary tree in Pre-order

Thursday, March 11th, 2010  »  Posted By  »  Total 1 Comment

/* Write C++ program that uses non-recursive functions to traverse a binary tree in Pre-order */ #include<iostream> #include<conio.h> #include<stdlib.h> using namespace std; class node { public: class node *left; class node *right; int data; };   class tree: public node { public: int stk[50],top; node *root; tree() { root=NULL; top=0; } void insert(int ch) { [...]

Java program to print Fibonacci sequence

Friday, October 2nd, 2009  »  Posted By  »  Total 2 Comments

Write a Java program that uses both recursive and non-recursive functions to print nth value in the Fibonacci sequence.

Question and Answer
C/C++ Unix & Linux Wordpress
Source codes
C C++ Java

Free email signup