Results 1 to 4 of 4
- 03-18-2009, 08:19 PM #1
Member
- Join Date
- Mar 2009
- Posts
- 9
- Rep Power
- 0
pleasee help me out for this recursive question!!!
can u help me to do coding for the question pleaseee!!!?
can u guys help me to do the coding for the question pleaseeeee!!?
Question:
Write a program that prints the elements of an array of size 11 in the reverse order. Use a recursive method
that takes as parameters the array and the size of the array to print it in reverse.
//prints the elements in the reverse order
Void printReverse (int a[], int n)
thanks
Andy
- 03-18-2009, 08:40 PM #2
- 03-18-2009, 08:49 PM #3
Senior Member
- Join Date
- Sep 2008
- Posts
- 564
- Rep Power
- 5
this has to be the worst use of recursion you can assign someone in java
- 03-18-2009, 09:45 PM #4
Member
- Join Date
- Mar 2009
- Posts
- 9
- Rep Power
- 0
i ve done it!!!
int a[] = new int[] {1,2,3,11,2,5,6,7,8,10,12};
printReverse (a,11);
}
public static void printReverse(int a[],int n) {
if (n == 0 ){
System.out.println("There is no value to return");
}
else if (n > 0){
System.out.println("The elements in the reverse order "+a[n-1]);
printReverse(a, n-1);
}
}
}
Similar Threads
-
Guys help me with recursive pleaseeee!!
By javasucks2009 in forum Advanced JavaReplies: 13Last Post: 03-22-2009, 03:37 AM -
Recursive Counting
By zlwilly in forum New To JavaReplies: 1Last Post: 01-29-2009, 08:42 PM -
Recursive Method
By bluegreen7hi in forum New To JavaReplies: 5Last Post: 11-29-2007, 04:45 AM -
Recursive Anagram
By zoe in forum Advanced JavaReplies: 1Last Post: 08-07-2007, 06:15 AM -
Help with recursive implementation
By toby in forum Advanced JavaReplies: 1Last Post: 08-07-2007, 05:57 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks